curvy 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/curve/cubic2d.d.mts +80 -2
  2. package/dist/curve/cubic2d.d.ts +80 -2
  3. package/dist/curve/cubic2d.mjs +9 -26
  4. package/dist/curve/cubic2d.mjs.map +1 -0
  5. package/dist/curve/linear2d.d.mts +68 -2
  6. package/dist/curve/linear2d.d.ts +68 -2
  7. package/dist/curve/linear2d.mjs +11 -14
  8. package/dist/curve/linear2d.mjs.map +1 -0
  9. package/dist/curve/quadratic2d.d.mts +86 -2
  10. package/dist/curve/quadratic2d.d.ts +86 -2
  11. package/dist/curve/quadratic2d.mjs +10 -15
  12. package/dist/curve/quadratic2d.mjs.map +1 -0
  13. package/dist/interval.d.mts +195 -2
  14. package/dist/interval.d.ts +195 -2
  15. package/dist/interval.mjs +9 -12
  16. package/dist/interval.mjs.map +1 -0
  17. package/dist/matrix/matrix2x2.d.mts +273 -2
  18. package/dist/matrix/matrix2x2.d.ts +273 -2
  19. package/dist/matrix/matrix2x2.mjs +5 -4
  20. package/dist/matrix/matrix2x2.mjs.map +1 -0
  21. package/dist/matrix/matrix3x3.d.mts +308 -1
  22. package/dist/matrix/matrix3x3.d.ts +308 -1
  23. package/dist/matrix/matrix3x3.mjs +5 -4
  24. package/dist/matrix/matrix3x3.mjs.map +1 -0
  25. package/dist/matrix/matrix4x4.d.mts +310 -1
  26. package/dist/matrix/matrix4x4.d.ts +310 -1
  27. package/dist/matrix/matrix4x4.mjs +24 -61
  28. package/dist/matrix/matrix4x4.mjs.map +1 -0
  29. package/dist/path/cubic2d.d.mts +68 -2
  30. package/dist/path/cubic2d.d.ts +68 -2
  31. package/dist/path/cubic2d.mjs +10 -12
  32. package/dist/path/cubic2d.mjs.map +1 -0
  33. package/dist/path/linear2d.d.mts +68 -2
  34. package/dist/path/linear2d.d.ts +68 -2
  35. package/dist/path/linear2d.mjs +7 -9
  36. package/dist/path/linear2d.mjs.map +1 -0
  37. package/dist/path/quadratic2d.d.mts +67 -2
  38. package/dist/path/quadratic2d.d.ts +67 -2
  39. package/dist/path/quadratic2d.mjs +9 -13
  40. package/dist/path/quadratic2d.mjs.map +1 -0
  41. package/dist/pipe.mjs +1 -0
  42. package/dist/pipe.mjs.map +1 -0
  43. package/dist/polynomial/cubic.d.mts +1 -1
  44. package/dist/polynomial/cubic.d.ts +1 -1
  45. package/dist/polynomial/cubic.mjs +13 -28
  46. package/dist/polynomial/cubic.mjs.map +1 -0
  47. package/dist/polynomial/linear.d.mts +1 -1
  48. package/dist/polynomial/linear.d.ts +1 -1
  49. package/dist/polynomial/linear.mjs +2 -1
  50. package/dist/polynomial/linear.mjs.map +1 -0
  51. package/dist/polynomial/quadratic.d.mts +2 -2
  52. package/dist/polynomial/quadratic.d.ts +2 -2
  53. package/dist/polynomial/quadratic.mjs +5 -2
  54. package/dist/polynomial/quadratic.mjs.map +1 -0
  55. package/dist/shared/{curvy.Cps2R_RU.mjs → curvy.BkkW8Tx9.mjs} +11 -29
  56. package/dist/shared/curvy.BkkW8Tx9.mjs.map +1 -0
  57. package/dist/shared/{curvy.BzVmUIKm.mjs → curvy.BxdGW9he.mjs} +17 -32
  58. package/dist/shared/curvy.BxdGW9he.mjs.map +1 -0
  59. package/dist/shared/{curvy.C2XGH0R0.mjs → curvy.C_sCeg9J.mjs} +15 -24
  60. package/dist/shared/curvy.C_sCeg9J.mjs.map +1 -0
  61. package/dist/shared/curvy.Cg8lZVUz.d.ts +688 -0
  62. package/dist/shared/{curvy.CE4X6_Is.mjs → curvy.DCt1gGII.mjs} +11 -45
  63. package/dist/shared/curvy.DCt1gGII.mjs.map +1 -0
  64. package/dist/shared/{curvy.BZ_mTkJe.mjs → curvy.DJ4xO0al.mjs} +9 -6
  65. package/dist/shared/curvy.DJ4xO0al.mjs.map +1 -0
  66. package/dist/shared/curvy.DmVFTi0N.mjs +1 -0
  67. package/dist/shared/curvy.DmVFTi0N.mjs.map +1 -0
  68. package/dist/shared/curvy.FDaj5rlj.d.mts +688 -0
  69. package/dist/shared/{curvy.Cv-wIzDr.mjs → curvy.lktriTpx.mjs} +19 -42
  70. package/dist/shared/curvy.lktriTpx.mjs.map +1 -0
  71. package/dist/shared/{curvy.wYJQhFW-.mjs → curvy.mLFprrGm.mjs} +14 -16
  72. package/dist/shared/curvy.mLFprrGm.mjs.map +1 -0
  73. package/dist/shared/{curvy.BDhiZ7He.mjs → curvy.r6f1j287.mjs} +8 -12
  74. package/dist/shared/curvy.r6f1j287.mjs.map +1 -0
  75. package/dist/splines/basis2d.d.mts +94 -2
  76. package/dist/splines/basis2d.d.ts +94 -2
  77. package/dist/splines/basis2d.mjs +13 -12
  78. package/dist/splines/basis2d.mjs.map +1 -0
  79. package/dist/splines/bezier2d.d.mts +136 -2
  80. package/dist/splines/bezier2d.d.ts +136 -2
  81. package/dist/splines/bezier2d.mjs +10 -9
  82. package/dist/splines/bezier2d.mjs.map +1 -0
  83. package/dist/splines/cardinal2d.d.mts +131 -2
  84. package/dist/splines/cardinal2d.d.ts +131 -2
  85. package/dist/splines/cardinal2d.mjs +15 -24
  86. package/dist/splines/cardinal2d.mjs.map +1 -0
  87. package/dist/splines/hermite2d.d.mts +94 -3
  88. package/dist/splines/hermite2d.d.ts +94 -3
  89. package/dist/splines/hermite2d.mjs +22 -36
  90. package/dist/splines/hermite2d.mjs.map +1 -0
  91. package/dist/utils.d.mts +179 -1
  92. package/dist/utils.d.ts +179 -1
  93. package/dist/utils.mjs +16 -7
  94. package/dist/utils.mjs.map +1 -0
  95. package/dist/vector/vector2.d.mts +259 -1
  96. package/dist/vector/vector2.d.ts +259 -1
  97. package/dist/vector/vector2.mjs +4 -2
  98. package/dist/vector/vector2.mjs.map +1 -0
  99. package/dist/vector/vector3.d.mts +341 -1
  100. package/dist/vector/vector3.d.ts +341 -1
  101. package/dist/vector/vector3.mjs +8 -2
  102. package/dist/vector/vector3.mjs.map +1 -0
  103. package/dist/vector/vector4.d.mts +163 -1
  104. package/dist/vector/vector4.d.ts +163 -1
  105. package/dist/vector/vector4.mjs +4 -2
  106. package/dist/vector/vector4.mjs.map +1 -0
  107. package/package.json +4 -4
  108. package/dist/shared/curvy.BsHoYJNv.d.ts +0 -155
  109. package/dist/shared/curvy.NsmY7zcr.d.mts +0 -155
@@ -7,57 +7,364 @@ import '../vector/vector2.mjs';
7
7
  declare const Matrix3x3TypeId: unique symbol;
8
8
  type Matrix3x3TypeId = typeof Matrix3x3TypeId;
9
9
 
10
+ /**
11
+ * A coordinate in a 3x3 matrix.
12
+ *
13
+ * @since 1.0.0
14
+ */
10
15
  type Matrix3x3Coordinate = ThreeDimensionalIndex | ThreeDimensionalComponent;
16
+ /**
17
+ * A 3x3 matrix.
18
+ *
19
+ * All fields are readonly and immutable, and all operations create new instances.
20
+ *
21
+ * @since 1.0.0
22
+ */
11
23
  interface Matrix3x3 extends Pipeable {
12
24
  readonly [Matrix3x3TypeId]: Matrix3x3TypeId;
25
+ /**
26
+ * The value of the first row and first column.
27
+ */
13
28
  readonly m00: number;
29
+ /**
30
+ * The value of the first row and second column.
31
+ */
14
32
  readonly m01: number;
33
+ /**
34
+ * The value of the first row and third column.
35
+ */
15
36
  readonly m02: number;
37
+ /**
38
+ * The value of the second row and first column.
39
+ */
16
40
  readonly m10: number;
41
+ /**
42
+ * The value of the second row and second column.
43
+ */
17
44
  readonly m11: number;
45
+ /**
46
+ * The value of the second row and third column.
47
+ */
18
48
  readonly m12: number;
49
+ /**
50
+ * The value of the third row and first column.
51
+ */
19
52
  readonly m20: number;
53
+ /**
54
+ * The value of the third row and second column.
55
+ */
20
56
  readonly m21: number;
57
+ /**
58
+ * The value of the third row and third column.
59
+ */
21
60
  readonly m22: number;
22
61
  }
62
+ /**
63
+ * Checks if a value is a `Matrix3x3`.
64
+ *
65
+ * @param m - The value to check.
66
+ * @returns `true` if the value is a `Matrix3x3`, `false` otherwise.
67
+ * @since 1.0.0
68
+ */
23
69
  declare const isMatrix3x3: (m: unknown) => m is Matrix3x3;
70
+ /**
71
+ * Creates a new `Matrix3x3` instance.
72
+ *
73
+ * @param m00 - The value of the first row and first column.
74
+ * @param m01 - The value of the first row and second column.
75
+ * @param m02 - The value of the first row and third column.
76
+ * @param m10 - The value of the second row and first column.
77
+ * @param m11 - The value of the second row and second column.
78
+ * @param m12 - The value of the second row and third column.
79
+ * @param m20 - The value of the third row and first column.
80
+ * @param m21 - The value of the third row and second column.
81
+ * @param m22 - The value of the third row and third column.
82
+ * @returns A new `Matrix3x3` instance.
83
+ * @since 1.0.0
84
+ */
24
85
  declare const matrix3x3: (m00?: number, m01?: number, m02?: number, m10?: number, m11?: number, m12?: number, m20?: number, m21?: number, m22?: number) => Matrix3x3;
86
+ /**
87
+ * Creates a new `Matrix3x3` instance from three row vectors.
88
+ *
89
+ * @param v0 - The first row vector.
90
+ * @param v1 - The second row vector.
91
+ * @param v2 - The third row vector.
92
+ * @returns A new `Matrix3x3` instance.
93
+ * @since 1.0.0
94
+ */
25
95
  declare const fromRows: (v0: Vector3, v1: Vector3, v2: Vector3) => Matrix3x3;
96
+ /**
97
+ * Creates a new `Matrix3x3` instance from three column vectors.
98
+ *
99
+ * @param v0 - The first column vector.
100
+ * @param v1 - The second column vector.
101
+ * @param v2 - The third column vector.
102
+ * @returns A new `Matrix3x3` instance.
103
+ * @since 1.0.0
104
+ */
26
105
  declare const fromColumns: (v0: Vector3, v1: Vector3, v2: Vector3) => Matrix3x3;
27
106
  declare const setRow: {
107
+ /**
108
+ * Sets a row of the matrix to a new vector.
109
+ *
110
+ * @param m - The matrix to set the row of.
111
+ * @param row - The row index to set.
112
+ * @param v - The new vector for the row.
113
+ * @returns A new matrix with the specified row set to the new vector.
114
+ */
28
115
  (m: Matrix3x3, row: Matrix3x3Coordinate, v: Vector3): Matrix3x3;
116
+ /**
117
+ * Sets a row of the matrix to a new vector.
118
+ *
119
+ * @param row - The row index to set.
120
+ * @param v - The new vector for the row.
121
+ * @returns A function that takes a matrix and returns a new matrix with the specified row set to the new vector.
122
+ */
29
123
  (row: Matrix3x3Coordinate, v: Vector3): (m: Matrix3x3) => Matrix3x3;
30
124
  };
31
125
  declare const setColumn: {
126
+ /**
127
+ * Sets a column of the matrix to a new vector.
128
+ *
129
+ * @param m - The matrix to set the column of.
130
+ * @param column - The column index to set.
131
+ * @param v - The new vector for the column.
132
+ * @returns A new matrix with the specified column set to the new vector.
133
+ */
32
134
  (m: Matrix3x3, column: Matrix3x3Coordinate, v: Vector3): Matrix3x3;
135
+ /**
136
+ * Sets a column of the matrix to a new vector.
137
+ *
138
+ * @param column - The column index to set.
139
+ * @param v - The new vector for the column.
140
+ * @returns A function that takes a matrix and returns a new matrix with the specified column set to the new vector.
141
+ */
33
142
  (column: Matrix3x3Coordinate, v: Vector3): (m: Matrix3x3) => Matrix3x3;
34
143
  };
144
+ /**
145
+ * Calculates the determinant of a 3x3 matrix.
146
+ *
147
+ * @param m - The matrix to calculate the determinant of.
148
+ * @returns The determinant of the matrix.
149
+ * @since 1.0.0
150
+ */
35
151
  declare const determinant: (m: Matrix3x3) => number;
152
+ /**
153
+ * Calculates the minor of a 3x3 matrix.
154
+ *
155
+ * @param m - The matrix to calculate the minor of.
156
+ * @param row - The row index of the element to calculate the minor for.
157
+ * @param column - The column index of the element to calculate the minor for.
158
+ * @returns The minor of the matrix at the specified row and column.
159
+ * @since 1.0.0
160
+ */
36
161
  declare const minor: (m: Matrix3x3, row: Matrix3x3Coordinate, column: Matrix3x3Coordinate) => Matrix2x2;
37
162
  declare const vectorProductLeft: {
163
+ /**
164
+ * Calculates the left vector product of a matrix and a vector.
165
+ *
166
+ * @example
167
+ * ```ts
168
+ * import * as Matrix3x3 from 'curvy/matrix3x3'
169
+ * import * as Vector3 from 'curvy/vector3'
170
+ *
171
+ * const m = Matrix3x3.matrix3x3(1, 2, 3, 4, 5, 6, 7, 8, 9)
172
+ * const v = Vector3.vector3(10, 11, 12)
173
+ *
174
+ * // Performs:
175
+ * // x = 1 * 10 + 2 * 11 + 3 * 12
176
+ * // y = 4 * 10 + 5 * 11 + 6 * 12
177
+ * // z = 7 * 10 + 8 * 11 + 9 * 12
178
+ * const result = Matrix3x3.vectorProductLeft(m, v)
179
+ * ```
180
+ * @param m - The matrix to calculate the left vector product with.
181
+ * @param v - The vector to calculate the left vector product with.
182
+ * @returns The resulting vector from the left vector product.
183
+ * @since 1.0.0
184
+ */
38
185
  (m: Matrix3x3, v: Vector3): Vector3;
186
+ /**
187
+ * Calculates the left vector product of a matrix and a vector.
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * import * as Matrix3x3 from 'curvy/matrix3x3'
192
+ * import * as Vector3 from 'curvy/vector3'
193
+ *
194
+ * const m = Matrix3x3.matrix3x3(1, 2, 3, 4, 5, 6, 7, 8, 9)
195
+ * const v = Vector3.vector3(10, 11, 12)
196
+ *
197
+ * // Performs:
198
+ * // x = 1 * 10 + 2 * 11 + 3 * 12
199
+ * // y = 4 * 10 + 5 * 11 + 6 * 12
200
+ * // z = 7 * 10 + 8 * 11 + 9 * 12
201
+ * const result = Matrix3x3.vectorProductLeft(v)(m)
202
+ * ```
203
+ * @param v - The vector to calculate the left vector product with.
204
+ * @returns A function that takes a matrix and returns the resulting vector from the left vector product.
205
+ */
39
206
  (v: Vector3): (m: Matrix3x3) => Vector3;
40
207
  };
41
208
  declare const vectorProductRight: {
209
+ /**
210
+ * Calculates the right vector product of a matrix and a vector.
211
+ *
212
+ * @example
213
+ * ```ts
214
+ * import * as Matrix3x3 from 'curvy/matrix3x3'
215
+ * import * as Vector3 from 'curvy/vector3'
216
+ *
217
+ * const m = Matrix3x3.matrix3x3(1, 2, 3, 4, 5, 6, 7, 8, 9)
218
+ * const v = Vector3.vector3(10, 11, 12)
219
+ *
220
+ * // Performs:
221
+ * // x = 1 * 10 + 4 * 11 + 7 * 12
222
+ * // y = 2 * 10 + 5 * 11 + 8 * 12
223
+ * // z = 3 * 10 + 6 * 11 + 9 * 12
224
+ * const result = Matrix3x3.vectorProductRight(m, v)
225
+ * ```
226
+ * @param m - The matrix to calculate the right vector product with.
227
+ * @param v - The vector to calculate the right vector product with.
228
+ * @returns The resulting vector from the right vector product.
229
+ */
42
230
  (m: Matrix3x3, v: Vector3): Vector3;
231
+ /**
232
+ * Calculates the right vector product of a matrix and a vector.
233
+ *
234
+ * @example
235
+ * ```ts
236
+ * import * as Matrix3x3 from 'curvy/matrix3x3'
237
+ * import * as Vector3 from 'curvy/vector3'
238
+ *
239
+ * const m = Matrix3x3.matrix3x3(1, 2, 3, 4, 5, 6, 7, 8, 9)
240
+ * const v = Vector3.vector3(10, 11, 12)
241
+ *
242
+ * // Performs:
243
+ * // x = 1 * 10 + 4 * 11 + 7 * 12
244
+ * // y = 2 * 10 + 5 * 11 + 8 * 12
245
+ * // z = 3 * 10 + 6 * 11 + 9 * 12
246
+ * const result = Matrix3x3.vectorProductRight(v)(m)
247
+ * ```
248
+ * @param v - The vector to calculate the right vector product with.
249
+ * @returns A function that takes a matrix and returns the resulting vector from the right vector product.
250
+ * @since 1.0.0
251
+ */
43
252
  (v: Vector3): (m: Matrix3x3) => Vector3;
44
253
  };
45
254
  declare const solveSystem: {
255
+ /**
256
+ * Solves a system of equations represented by a matrix and a vector.
257
+ *
258
+ * @example
259
+ * ```ts
260
+ * import * as Matrix3x3 from 'curvy/matrix3x3'
261
+ * import * as Vector3 from 'curvy/vector3'
262
+ *
263
+ * const m = Matrix3x3.matrix3x3(1, 2, 3, 4, 5, 6, 7, 8, 9)
264
+ * const v = Vector3.vector3(10, 11, 12)
265
+ *
266
+ * // Performs:
267
+ * // x = m00 * x + m01 * y + m02 * z
268
+ * // y = m10 * x + m11 * y + m12 * z
269
+ * // z = m20 * x + m21 * y + m22 * z
270
+ * const result = Matrix3x3.solveSystem(m, v)
271
+ * ```
272
+ */
46
273
  (m: Matrix3x3, v: Vector3): Vector3;
274
+ /**
275
+ * Solves a system of equations represented by a matrix and a vector.
276
+ *
277
+ * @example
278
+ * ```ts
279
+ * import * as Matrix3x3 from 'curvy/matrix3x3'
280
+ * import * as Vector3 from 'curvy/vector3'
281
+ *
282
+ * const m = Matrix3x3.matrix3x3(1, 2, 3, 4, 5, 6, 7, 8, 9)
283
+ * const v = Vector3.vector3(10, 11, 12)
284
+ *
285
+ * // Performs:
286
+ * // x = m00 * x + m01 * y + m02 * z
287
+ * // y = m10 * x + m11 * y + m12 * z
288
+ * // z = m20 * x + m21 * y + m22 * z
289
+ * const result = Matrix3x3.solveSystem(v)(m)
290
+ * ```
291
+ */
47
292
  (v: Vector3): (m: Matrix3x3) => Vector3;
48
293
  };
294
+ /**
295
+ * Returns the rows of a `Matrix3x3` as an array of vectors.
296
+ *
297
+ * @param m - The matrix to get the rows from.
298
+ * @returns An array of vectors representing the rows of the matrix.
299
+ * @since 1.0.0
300
+ */
49
301
  declare const toRows: (m: Matrix3x3) => [Vector3, Vector3, Vector3];
302
+ /**
303
+ * Returns the columns of a `Matrix3x3` as an array of vectors.
304
+ *
305
+ * @param m - The matrix to get the columns from.
306
+ * @returns An array of vectors representing the columns of the matrix.
307
+ * @since 1.0.0
308
+ */
50
309
  declare const toColumns: (m: Matrix3x3) => [Vector3, Vector3, Vector3];
51
310
  declare const rowVector: {
311
+ /**
312
+ * Gets a row vector from the matrix.
313
+ *
314
+ * @param m - The matrix to get the row vector from.
315
+ * @param row - The row index to get the vector from.
316
+ * @returns The row vector at the specified index.
317
+ */
52
318
  (m: Matrix3x3, row: Matrix3x3Coordinate): Vector3;
319
+ /**
320
+ * Gets a row vector from the matrix.
321
+ *
322
+ * @param row - The row index to get the vector from.
323
+ * @returns A function that takes a matrix and returns the row vector at the specified index.
324
+ */
53
325
  (row: Matrix3x3Coordinate): (m: Matrix3x3) => Vector3;
54
326
  };
55
327
  declare const columnVector: {
328
+ /**
329
+ * Gets a column vector from the matrix.
330
+ *
331
+ * @param m - The matrix to get the column vector from.
332
+ * @param column - The column index to get the vector from.
333
+ * @returns The column vector at the specified index.
334
+ */
56
335
  (m: Matrix3x3, column: Matrix3x3Coordinate): Vector3;
336
+ /**
337
+ * Gets a column vector from the matrix.
338
+ *
339
+ * @param column - The column index to get the vector from.
340
+ * @returns A function that takes a matrix and returns the column vector at the specified index.
341
+ */
57
342
  (column: Matrix3x3Coordinate): (m: Matrix3x3) => Vector3;
58
343
  };
344
+ /**
345
+ * Transposes a `Matrix3x3`.
346
+ *
347
+ * @param m - The matrix to transpose.
348
+ * @returns A new `Matrix3x3` instance that is the transpose of the input matrix.
349
+ * @since 1.0.0
350
+ */
59
351
  declare const transpose: (m: Matrix3x3) => Matrix3x3;
352
+ /**
353
+ * Reverses the rows of a `Matrix3x3`.
354
+ *
355
+ * @param m - The matrix to reverse the rows of.
356
+ * @returns A new `Matrix3x3` instance with the rows reversed.
357
+ * @since 1.0.0
358
+ */
60
359
  declare const reverseRows: (m: Matrix3x3) => Matrix3x3;
360
+ /**
361
+ * Reverses the columns of a `Matrix3x3`.
362
+ *
363
+ * @param m - The matrix to reverse the columns of.
364
+ * @returns A new `Matrix3x3` instance with the columns reversed.
365
+ * @since 1.0.0
366
+ */
61
367
  declare const reverseColumns: (m: Matrix3x3) => Matrix3x3;
62
368
 
63
- export { type Matrix3x3, type Matrix3x3Coordinate, columnVector, determinant, fromColumns, fromRows, isMatrix3x3, matrix3x3, minor, reverseColumns, reverseRows, rowVector, setColumn, setRow, solveSystem, toColumns, toRows, transpose, vectorProductLeft, vectorProductRight };
369
+ export { columnVector, determinant, fromColumns, fromRows, isMatrix3x3, matrix3x3, minor, reverseColumns, reverseRows, rowVector, setColumn, setRow, solveSystem, toColumns, toRows, transpose, vectorProductLeft, vectorProductRight };
370
+ export type { Matrix3x3, Matrix3x3Coordinate };