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
package/dist/utils.d.ts DELETED
@@ -1,205 +0,0 @@
1
- /**
2
- * @since 1.0.0
3
- */
4
- declare const PRECISION = 8;
5
- /**
6
- * Rounding function that rounds a number to a specified precision.
7
- *
8
- * @param value - The number to round.
9
- * @param precision - The number of decimal places to round to (default is 8).
10
- * @returns The rounded number.
11
- * @example
12
- * ```ts
13
- * import { round } from 'curvy/utils'
14
- *
15
- * const roundedValue = round(1.23456789, 4) // 1.2346
16
- * const roundedValue2 = round(1.23456789) // 1.23456789
17
- * ```
18
- * @since 1.0.0
19
- */
20
- declare function round(value: number, precision?: number): number;
21
- /**
22
- * Rounding function that rounds a number down to a specified precision.
23
- *
24
- * @param value - The number to round down.
25
- * @param precision - The number of decimal places to round down to (default is 8).
26
- * @returns The rounded down number.
27
- * @example
28
- * ```ts
29
- * import { roundDown } from 'curvy/utils'
30
- *
31
- * const roundedDownValue = roundDown(1.23456789, 4) // 1.2345
32
- * const roundedDownValue2 = roundDown(1.23456789) // 1.23456789
33
- * ```
34
- * @since 1.0.0
35
- */
36
- declare function roundDown(value: number, precision?: number): number;
37
- /**
38
- * Rounding function that rounds a number up to a specified precision.
39
- *
40
- * @param value - The number to round up.
41
- * @param precision - The number of decimal places to round up to (default is 8).
42
- * @returns The rounded up number.
43
- * @example
44
- * ```ts
45
- * import { roundUp } from 'curvy/utils'
46
- *
47
- * const roundedUpValue = roundUp(1.23456789, 4) // 1.2346
48
- * const roundedUpValue2 = roundUp(1.23456789) // 1.23456789
49
- * ```
50
- * @since 1.0.0
51
- */
52
- declare function roundUp(value: number, precision?: number): number;
53
- /**
54
- * Linear interpolation function.
55
- *
56
- * @param t - The interpolation factor (between 0 and 1).
57
- * @param a - The start value.
58
- * @param b - The end value.
59
- * @returns The interpolated value.
60
- * @example
61
- * ```ts
62
- * import { lerp } from 'curvy/utils'
63
- *
64
- * const interpolatedValue = lerp(0.5, 10, 20) // 15
65
- * const interpolatedValue2 = lerp(0.5)(10, 20) // 15
66
- * ```
67
- * @since 1.0.0
68
- */
69
- declare const lerp: {
70
- (t: number, a: number, b: number): number;
71
- (a: number, b: number): (t: number) => number;
72
- };
73
- /**
74
- * Normalizes a value between two bounds.
75
- *
76
- * @param x - The value to normalize.
77
- * @param a - The lower bound.
78
- * @param b - The upper bound.
79
- * @returns The normalized value.
80
- * @example
81
- * ```ts
82
- * import { normalize } from 'curvy/utils'
83
- *
84
- * const normalizedValue = normalize(15, 10, 20) // 0.5
85
- * const normalizedValue2 = normalize(10, 20)(15) // 0.5
86
- * ```
87
- * @since 1.0.0
88
- */
89
- declare const normalize: {
90
- (x: number, a: number, b: number): number;
91
- (a: number, b: number): (x: number) => number;
92
- };
93
- /**
94
- * Remaps a value from one range to another.
95
- *
96
- * @param x - The value to remap.
97
- * @param x1 - The lower bound of the original range.
98
- * @param x2 - The upper bound of the original range.
99
- * @param y1 - The lower bound of the new range.
100
- * @param y2 - The upper bound of the new range.
101
- * @returns The remapped value.
102
- * @example
103
- * ```ts
104
- * import { remap } from 'curvy/utils'
105
- *
106
- * const remappedValue = remap(15, 10, 20, 0, 100) // 50
107
- * const remappedValue2 = remap(10, 20, 0, 100)(15) // 50
108
- * ```
109
- * @since 1.0.0
110
- */
111
- declare const remap: {
112
- (x: number, x1: number, x2: number, y1: number, y2: number): number;
113
- (x1: number, x2: number, y1: number, y2: number): (x: number) => number;
114
- };
115
- /**
116
- * Clamps a value between two bounds.
117
- *
118
- * @param value - The value to clamp.
119
- * @param min - The lower bound.
120
- * @param max - The upper bound.
121
- * @returns The clamped value.
122
- * @example
123
- * ```ts
124
- * import { clamp } from 'curvy/utils'
125
- *
126
- * const clampedValue = clamp(25, 10, 20) // 20
127
- * const clampedValue2 = clamp(10, 20)(25) // 20
128
- * ```
129
- * @since 1.0.0
130
- */
131
- declare const clamp: {
132
- (value: number, min: number, max: number): number;
133
- (min: number, max: number): (value: number) => number;
134
- };
135
- /**
136
- * Clips a value to a specified range, returning a fallback value if the value is outside the range.
137
- *
138
- * @param value - The value to clip.
139
- * @param min - The lower bound.
140
- * @param max - The upper bound.
141
- * @param onClip - The fallback value to return if the value is outside the range.
142
- * @returns The clipped value or the fallback value.
143
- * @example
144
- * ```ts
145
- * import { clip } from 'curvy/utils'
146
- *
147
- * const clippedValue = clip(25, 10, 20, 15) // 15
148
- * const clippedValue2 = clip(10, 20, 15)(25) // 15
149
- * ```
150
- * @since 1.0.0
151
- */
152
- declare const clip: {
153
- <T>(value: number, min: number, max: number, onClip: T): T | number;
154
- <T>(min: number, max: number, onClip: T): (value: number) => T | number;
155
- };
156
- /**
157
- * Returns the minimum and maximum of two numbers.
158
- *
159
- * @param a - The first number.
160
- * @param b - The second number.
161
- * @returns A tuple containing the minimum and maximum values.
162
- * @example
163
- * ```ts
164
- * import { minMax } from 'curvy/utils'
165
- *
166
- * const [minValue, maxValue] = minMax(10, 20) // [10, 20]
167
- * const [minValue2, maxValue2] = minMax(20, 10) // [10, 20]
168
- * ```
169
- * @since 1.0.0
170
- */
171
- declare function minMax(a: number, b: number): [number, number];
172
- /**
173
- * Calculates the modulus of a number.
174
- *
175
- * @param n - The number to calculate the modulus of.
176
- * @param m - The modulus.
177
- * @returns The modulus of the number.
178
- * @example
179
- * ```ts
180
- * import { mod } from 'curvy/utils'
181
- *
182
- * const modulus = mod(10, 3) // 1
183
- * const modulus2 = mod(-10, 3) // 2
184
- * ```
185
- * @since 1.0.0
186
- */
187
- declare function mod(n: number, m: number): number;
188
- /**
189
- * Asserts that a condition is true, throwing an error with the provided message if it is not.
190
- *
191
- * @param condition - The condition to assert.
192
- * @param message - The error message to throw if the condition is false.
193
- * @throws An error with the provided message if the condition is false.
194
- * @example
195
- * ```ts
196
- * import { invariant } from 'curvy/utils'
197
- *
198
- * invariant(1 + 1 === 2, 'Math is broken!') // No error
199
- * invariant(1 + 1 === 3, 'Math is broken!') // Throws: Math is broken!
200
- * ```
201
- * @since 1.0.0
202
- */
203
- declare function invariant(condition: boolean, message: string): asserts condition;
204
-
205
- export { PRECISION, clamp, clip, invariant, lerp, minMax, mod, normalize, remap, round, roundDown, roundUp };
@@ -1,324 +0,0 @@
1
- import { T as TwoDimensional } from '../shared/curvy.Bf5TIk31.mjs';
2
- import { Pipeable } from '../pipe.mjs';
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 };