curvy 2.0.0-alpha.6 → 2.0.0-alpha.7
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 → characteristic.d.ts} +9 -17
- package/dist/characteristic/index.d.ts +1 -0
- package/dist/characteristic/index.mjs +1 -1
- package/dist/curve/cubic2d.d.ts +215 -0
- package/dist/curve/cubic2d.internal.d.ts +2 -0
- package/dist/curve/index.d.ts +12 -0
- package/dist/curve/index.mjs +1 -1
- package/dist/curve/linear2d.d.ts +195 -0
- package/dist/curve/linear2d.internal.d.ts +2 -0
- package/dist/curve/quadratic2d.d.ts +223 -0
- package/dist/curve/quadratic2d.internal.d.ts +2 -0
- package/dist/curve/rationalCubic2d.d.ts +241 -0
- package/dist/curve/rationalCubic2d.internal.d.ts +2 -0
- package/dist/dimensions.d.ts +23 -0
- package/dist/interval/index.d.ts +6 -0
- package/dist/interval/index.mjs +2 -2
- package/dist/interval/interval.d.ts +525 -0
- package/dist/interval/interval.internal.d.ts +1 -0
- package/dist/interval/interval2d.d.ts +204 -0
- package/dist/interval/interval2d.internal.d.ts +2 -0
- package/dist/length.d.ts +32 -0
- package/dist/matrix/index.d.ts +9 -0
- package/dist/matrix/index.mjs +1 -1
- package/dist/matrix/index.mjs.map +1 -1
- package/dist/matrix/matrix2x2.d.ts +335 -0
- package/dist/matrix/matrix2x2.internal.d.ts +2 -0
- package/dist/matrix/matrix3x3.d.ts +396 -0
- package/dist/matrix/matrix3x3.internal.d.ts +4 -0
- package/dist/matrix/matrix4x4.d.ts +439 -0
- package/dist/matrix/matrix4x4.internal.d.ts +2 -0
- package/dist/number.d.ts +276 -0
- package/dist/number.mjs.map +1 -1
- package/dist/path/cubic2d.d.ts +262 -0
- package/dist/path/cubic2d.internal.d.ts +2 -0
- package/dist/path/index.d.ts +12 -0
- package/dist/path/index.mjs +413 -4
- package/dist/path/index.mjs.map +1 -1
- package/dist/path/linear2d.d.ts +245 -0
- package/dist/path/linear2d.internal.d.ts +2 -0
- package/dist/path/quadratic2d.d.ts +234 -0
- package/dist/path/quadratic2d.internal.d.ts +2 -0
- package/dist/path/rationalCubic2d.d.ts +116 -0
- package/dist/path/rationalCubic2d.internal.d.ts +2 -0
- package/dist/path/traits.d.ts +95 -0
- package/dist/polynomial/cubic.d.ts +377 -0
- package/dist/polynomial/cubic.internal.circular.d.ts +2 -0
- package/dist/polynomial/cubic.internal.d.ts +1 -0
- package/dist/polynomial/index.d.ts +9 -0
- package/dist/polynomial/index.mjs +2 -2
- package/dist/polynomial/linear.d.ts +317 -0
- package/dist/polynomial/linear.internal.d.ts +2 -0
- package/dist/polynomial/monotonicity.d.ts +3 -0
- package/dist/polynomial/quadratic.d.ts +371 -0
- package/dist/polynomial/quadratic.internal.circular.d.ts +2 -0
- package/dist/polynomial/quadratic.internal.d.ts +1 -0
- package/dist/polynomial/traits.d.ts +56 -0
- package/dist/shared/{characteristic-DLlhja-I.mjs → characteristic-D9yZWCym.mjs} +3 -3
- package/dist/shared/characteristic-D9yZWCym.mjs.map +1 -0
- package/dist/shared/{cubic-CMonq6bg.mjs → cubic-BK8xjSkd.mjs} +79 -4
- package/dist/shared/cubic-BK8xjSkd.mjs.map +1 -0
- package/dist/shared/{interval-X1EYuf-T.mjs → interval-CqC3ZIqj.mjs} +40 -1
- package/dist/shared/interval-CqC3ZIqj.mjs.map +1 -0
- package/dist/shared/{interval2d-ca0J1NMr.mjs → interval2d-BMDmeL1M.mjs} +45 -4
- package/dist/shared/interval2d-BMDmeL1M.mjs.map +1 -0
- package/dist/shared/{matrix4x4-Ck2WROK-.mjs → matrix4x4-qyRufxfs.mjs} +62 -3
- package/dist/shared/matrix4x4-qyRufxfs.mjs.map +1 -0
- package/dist/shared/{quadratic-DyeMtvET.mjs → quadratic-CWXIRh42.mjs} +2 -2
- package/dist/shared/quadratic-CWXIRh42.mjs.map +1 -0
- package/dist/shared/{rationalCubic2d-Vw4qGPZj.mjs → rationalCubic2d-BZvT9s5N.mjs} +218 -5
- package/dist/shared/rationalCubic2d-BZvT9s5N.mjs.map +1 -0
- package/dist/shared/{rationalCubic2d-D658ltUM.mjs → rationalCubic2d-DaFTrUXw.mjs} +250 -36
- package/dist/shared/rationalCubic2d-DaFTrUXw.mjs.map +1 -0
- package/dist/shared/{solution-3TDATEMn.mjs → solution-UKGK826h.mjs} +22 -2
- package/dist/shared/solution-UKGK826h.mjs.map +1 -0
- package/dist/shared/{vector2-CCuJx1rX.mjs → vector2-CWU3cPB2.mjs} +12 -2
- package/dist/shared/vector2-CWU3cPB2.mjs.map +1 -0
- package/dist/shared/{vector2.internal-DU_E808S.mjs → vector2.internal-BL8hFl1c.mjs} +31 -2
- package/dist/shared/vector2.internal-BL8hFl1c.mjs.map +1 -0
- package/dist/shared/{vector3-C-qgKAjR.mjs → vector3-DmMm6pX8.mjs} +12 -2
- package/dist/shared/vector3-DmMm6pX8.mjs.map +1 -0
- package/dist/shared/{vector4-BhOKDhD5.mjs → vector4-oqPPp45j.mjs} +12 -2
- package/dist/shared/vector4-oqPPp45j.mjs.map +1 -0
- package/dist/shared/{vector4.internal-5XcaX12X.mjs → vector4.internal-BnnTjVIr.mjs} +45 -2
- package/dist/shared/vector4.internal-BnnTjVIr.mjs.map +1 -0
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.mjs +1 -1
- package/dist/{shared/solution-Cf_zoKFU.d.mts → solution/solution.d.ts} +64 -71
- package/dist/solution/solution.internal.d.ts +2 -0
- package/dist/splines/basis2d.d.ts +118 -0
- package/dist/splines/basis2d.internal.d.ts +2 -0
- package/dist/splines/bezier2d.d.ts +198 -0
- package/dist/splines/bezier2d.internal.d.ts +2 -0
- package/dist/splines/cardinal2d.d.ts +269 -0
- package/dist/splines/cardinal2d.internal.d.ts +2 -0
- package/dist/splines/hermite2d.d.ts +113 -0
- package/dist/splines/hermite2d.internal.d.ts +2 -0
- package/dist/splines/index.d.ts +15 -0
- package/dist/splines/index.mjs +62 -8
- package/dist/splines/index.mjs.map +1 -1
- package/dist/splines/rationalBezier2d.d.ts +144 -0
- package/dist/splines/rationalBezier2d.internal.d.ts +2 -0
- package/dist/splines/util.d.ts +5 -0
- package/dist/utils.d.ts +73 -0
- package/dist/vector/index.d.ts +9 -0
- package/dist/vector/index.mjs +3 -3
- package/dist/vector/vector2.d.ts +449 -0
- package/dist/vector/vector2.internal.d.ts +4 -0
- package/dist/vector/vector3.d.ts +454 -0
- package/dist/vector/vector3.internal.d.ts +2 -0
- package/dist/vector/vector4.d.ts +258 -0
- package/dist/vector/vector4.internal.d.ts +2 -0
- package/package.json +13 -13
- package/dist/curve/index.d.mts +0 -2
- package/dist/interval/index.d.mts +0 -3
- package/dist/matrix/index.d.mts +0 -2
- package/dist/number.d.mts +0 -280
- package/dist/path/index.d.mts +0 -261
- package/dist/polynomial/index.d.mts +0 -2
- package/dist/shared/characteristic-DLlhja-I.mjs.map +0 -1
- package/dist/shared/cubic-C3ZMAoGj.d.mts +0 -1124
- package/dist/shared/cubic-CMonq6bg.mjs.map +0 -1
- package/dist/shared/interval-CSntLeSX.d.mts +0 -533
- package/dist/shared/interval-X1EYuf-T.mjs.map +0 -1
- package/dist/shared/interval2d-D42_0ka1.d.mts +0 -172
- package/dist/shared/interval2d-ca0J1NMr.mjs.map +0 -1
- package/dist/shared/matrix4x4-Ck2WROK-.mjs.map +0 -1
- package/dist/shared/matrix4x4-gy9ejrX2.d.mts +0 -1183
- package/dist/shared/quadratic-DyeMtvET.mjs.map +0 -1
- package/dist/shared/rationalCubic2d-C1RBShBF.d.mts +0 -818
- package/dist/shared/rationalCubic2d-D658ltUM.mjs.map +0 -1
- package/dist/shared/rationalCubic2d-DFFvp5S1.d.mts +0 -308
- package/dist/shared/rationalCubic2d-Vw4qGPZj.mjs.map +0 -1
- package/dist/shared/solution-3TDATEMn.mjs.map +0 -1
- package/dist/shared/utils-MCckigYk.d.mts +0 -76
- package/dist/shared/vector2-5GyA0jBj.d.mts +0 -470
- package/dist/shared/vector2-CCuJx1rX.mjs.map +0 -1
- package/dist/shared/vector2.internal-DU_E808S.mjs.map +0 -1
- package/dist/shared/vector3-BfOPFZEn.d.mts +0 -703
- package/dist/shared/vector3-C-qgKAjR.mjs.map +0 -1
- package/dist/shared/vector4-BhOKDhD5.mjs.map +0 -1
- package/dist/shared/vector4.internal-5XcaX12X.mjs.map +0 -1
- package/dist/solution/index.d.mts +0 -2
- package/dist/splines/index.d.mts +0 -858
- package/dist/utils.d.mts +0 -2
- package/dist/vector/index.d.mts +0 -3
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import type { TwoDimensionalComponent, TwoDimensionalIndex } from '../dimensions.ts';
|
|
2
|
+
import type { Pipeable } from '../utils.ts';
|
|
3
|
+
import type { Vector2 } from '../vector/vector2.ts';
|
|
4
|
+
import type { Matrix2x2TypeId } from './matrix2x2.internal.ts';
|
|
5
|
+
/**
|
|
6
|
+
* A type representing the coordinate of a 2D matrix.
|
|
7
|
+
*
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
export type Matrix2x2Coordinate = TwoDimensionalIndex | TwoDimensionalComponent;
|
|
11
|
+
/**
|
|
12
|
+
* A 2D matrix with 2 rows and 2 columns.
|
|
13
|
+
*
|
|
14
|
+
* All fields are readonly and immutable, and all operations create new instances.
|
|
15
|
+
*
|
|
16
|
+
* @since 1.0.0
|
|
17
|
+
*/
|
|
18
|
+
export interface Matrix2x2 extends Pipeable {
|
|
19
|
+
readonly [Matrix2x2TypeId]: Matrix2x2TypeId;
|
|
20
|
+
/**
|
|
21
|
+
* The value in the first row and first column.
|
|
22
|
+
*/
|
|
23
|
+
readonly m00: number;
|
|
24
|
+
/**
|
|
25
|
+
* The value in the first row and second column.
|
|
26
|
+
*/
|
|
27
|
+
readonly m01: number;
|
|
28
|
+
/**
|
|
29
|
+
* The value in the second row and first column.
|
|
30
|
+
*/
|
|
31
|
+
readonly m10: number;
|
|
32
|
+
/**
|
|
33
|
+
* The value in the second row and second column.
|
|
34
|
+
*/
|
|
35
|
+
readonly m11: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Checks if a value is a `Matrix2x2`.
|
|
39
|
+
*
|
|
40
|
+
* @param m - The value to check.
|
|
41
|
+
* @returns `true` if the value is a `Matrix2x2`, `false` otherwise.
|
|
42
|
+
* @since 1.0.0
|
|
43
|
+
*/
|
|
44
|
+
export declare const isMatrix2x2: (m: unknown) => m is Matrix2x2;
|
|
45
|
+
export declare const equals: {
|
|
46
|
+
/**
|
|
47
|
+
* Checks if two `Matrix2x2` instances are approximately equal within the
|
|
48
|
+
* default absolute tolerance ({@link EPSILON}).
|
|
49
|
+
*
|
|
50
|
+
* @param a - The first matrix.
|
|
51
|
+
* @param b - The second matrix.
|
|
52
|
+
* @returns `true` when each pair of components is within tolerance.
|
|
53
|
+
* @since 1.1.0
|
|
54
|
+
*/
|
|
55
|
+
(a: Matrix2x2, b: Matrix2x2): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Checks if two `Matrix2x2` instances are approximately equal within the
|
|
58
|
+
* default absolute tolerance ({@link EPSILON}).
|
|
59
|
+
*
|
|
60
|
+
* @param b - The second matrix.
|
|
61
|
+
* @returns A function that takes the first matrix and returns the comparison result.
|
|
62
|
+
* @since 1.1.0
|
|
63
|
+
*/
|
|
64
|
+
(b: Matrix2x2): (a: Matrix2x2) => boolean;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Creates a new `Matrix2x2` instance.
|
|
68
|
+
*
|
|
69
|
+
* @param m00 - The value in the first row and first column. Defaults to 0.
|
|
70
|
+
* @param m01 - The value in the first row and second column. Defaults to 0.
|
|
71
|
+
* @param m10 - The value in the second row and first column. Defaults to 0.
|
|
72
|
+
* @param m11 - The value in the second row and second column. Defaults to 0.
|
|
73
|
+
*/
|
|
74
|
+
export declare const make: (m00?: number, m01?: number, m10?: number, m11?: number) => Matrix2x2;
|
|
75
|
+
/**
|
|
76
|
+
* Creates a new `Matrix2x2` instance from two vectors representing rows.
|
|
77
|
+
*
|
|
78
|
+
* @param v0 - The first row vector.
|
|
79
|
+
* @param v1 - The second row vector.
|
|
80
|
+
* @returns A new `Matrix2x2` instance.
|
|
81
|
+
* @since 1.0.0
|
|
82
|
+
*/
|
|
83
|
+
export declare const fromRows: (v0: Vector2, v1: Vector2) => Matrix2x2;
|
|
84
|
+
/**
|
|
85
|
+
* Creates a new `Matrix2x2` instance from two vectors representing columns.
|
|
86
|
+
*
|
|
87
|
+
* @param v0 - The first column vector.
|
|
88
|
+
* @param v1 - The second column vector.
|
|
89
|
+
* @returns A new `Matrix2x2` instance.
|
|
90
|
+
* @since 1.0.0
|
|
91
|
+
*/
|
|
92
|
+
export declare const fromColumns: (v0: Vector2, v1: Vector2) => Matrix2x2;
|
|
93
|
+
export declare const setRow: {
|
|
94
|
+
/**
|
|
95
|
+
* Sets the specified row of the matrix to the given vector.
|
|
96
|
+
*
|
|
97
|
+
* @param m - The matrix to modify.
|
|
98
|
+
* @param row - The row index (0 or 1).
|
|
99
|
+
* @param v - The vector to set the row to.
|
|
100
|
+
* @returns A new `Matrix2x2` instance with the specified row set to the given vector.
|
|
101
|
+
* @since 1.0.0
|
|
102
|
+
*/
|
|
103
|
+
(m: Matrix2x2, row: Matrix2x2Coordinate, v: Vector2): Matrix2x2;
|
|
104
|
+
/**
|
|
105
|
+
* Sets the specified row of the matrix to the given vector.
|
|
106
|
+
*
|
|
107
|
+
* @param row - The row index (0 or 1).
|
|
108
|
+
* @param v - The vector to set the row to.
|
|
109
|
+
* @returns A function that takes a matrix and returns a new `Matrix2x2` instance with the specified row set to the given vector.
|
|
110
|
+
* @since 1.0.0
|
|
111
|
+
*/
|
|
112
|
+
(row: Matrix2x2Coordinate, v: Vector2): (m: Matrix2x2) => Matrix2x2;
|
|
113
|
+
};
|
|
114
|
+
export declare const setColumn: {
|
|
115
|
+
/**
|
|
116
|
+
* Sets the specified column of the matrix to the given vector.
|
|
117
|
+
*
|
|
118
|
+
* @param m - The matrix to modify.
|
|
119
|
+
* @param column - The column index (0 or 1).
|
|
120
|
+
* @param v - The vector to set the column to.
|
|
121
|
+
* @returns A new `Matrix2x2` instance with the specified column set to the given vector.
|
|
122
|
+
* @since 1.0.0
|
|
123
|
+
*/
|
|
124
|
+
(m: Matrix2x2, column: Matrix2x2Coordinate, v: Vector2): Matrix2x2;
|
|
125
|
+
/**
|
|
126
|
+
* Sets the specified column of the matrix to the given vector.
|
|
127
|
+
*
|
|
128
|
+
* @param column - The column index (0 or 1).
|
|
129
|
+
* @param v - The vector to set the column to.
|
|
130
|
+
* @returns A function that takes a matrix and returns a new `Matrix2x2` instance with the specified column set to the given vector.
|
|
131
|
+
* @since 1.0.0
|
|
132
|
+
*/
|
|
133
|
+
(column: Matrix2x2Coordinate, v: Vector2): (m: Matrix2x2) => Matrix2x2;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Calculates the determinant of a 2D matrix.
|
|
137
|
+
*
|
|
138
|
+
* @param m - The matrix to calculate the determinant for.
|
|
139
|
+
* @returns The determinant of the matrix.
|
|
140
|
+
* @since 1.0.0
|
|
141
|
+
*/
|
|
142
|
+
export declare const determinant: (m: Matrix2x2) => number;
|
|
143
|
+
export declare const vectorProductLeft: {
|
|
144
|
+
/**
|
|
145
|
+
* Calculates the left vector product of a matrix and a vector.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* import * as Matrix2x2 from 'curvy/matrix2x2'
|
|
150
|
+
* import * as Vector2 from 'curvy/vector2'
|
|
151
|
+
*
|
|
152
|
+
* const matrix = Matrix2x2.make(1, 2, 3, 4)
|
|
153
|
+
* const vector = Vector2.make(5, 6)
|
|
154
|
+
*
|
|
155
|
+
* // Performs:
|
|
156
|
+
* // x = 1 * 5 + 2 * 6 = 17
|
|
157
|
+
* // y = 3 * 5 + 4 * 6 = 39
|
|
158
|
+
* const result = Matrix2x2.vectorProductLeft(matrix, vector)
|
|
159
|
+
* ```
|
|
160
|
+
* @param m - The matrix to multiply.
|
|
161
|
+
* @param v - The vector to multiply.
|
|
162
|
+
* @returns The resulting vector after the left vector product.
|
|
163
|
+
* @since 1.0.0
|
|
164
|
+
*/
|
|
165
|
+
(m: Matrix2x2, v: Vector2): Vector2;
|
|
166
|
+
/**
|
|
167
|
+
* Calculates the left vector product of a matrix and a vector.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* import * as Matrix2x2 from 'curvy/matrix2x2'
|
|
172
|
+
* import * as Vector2 from 'curvy/vector2'
|
|
173
|
+
*
|
|
174
|
+
* const matrix = Matrix2x2.make(1, 2, 3, 4)
|
|
175
|
+
* const vector = Vector2.make(5, 6)
|
|
176
|
+
*
|
|
177
|
+
* // Performs:
|
|
178
|
+
* // x = 1 * 5 + 2 * 6 = 17
|
|
179
|
+
* // y = 3 * 5 + 4 * 6 = 39
|
|
180
|
+
* const result = Matrix2x2.vectorProductLeft(vector)(matrix)
|
|
181
|
+
* ```
|
|
182
|
+
* @param v - The vector to multiply.
|
|
183
|
+
* @returns A function that takes a matrix and returns the resulting vector after the left vector product.
|
|
184
|
+
* @since 1.0.0
|
|
185
|
+
*/
|
|
186
|
+
(v: Vector2): (m: Matrix2x2) => Vector2;
|
|
187
|
+
};
|
|
188
|
+
export declare const vectorProductRight: {
|
|
189
|
+
/**
|
|
190
|
+
* Calculates the right vector product of a matrix and a vector.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* import * as Matrix2x2 from 'curvy/matrix2x2'
|
|
195
|
+
* import * as Vector2 from 'curvy/vector2'
|
|
196
|
+
*
|
|
197
|
+
* const matrix = Matrix2x2.make(1, 2, 3, 4)
|
|
198
|
+
* const vector = Vector2.make(5, 6)
|
|
199
|
+
*
|
|
200
|
+
* // Performs:
|
|
201
|
+
* // x = 1 * 5 + 3 * 6 = 33
|
|
202
|
+
* // y = 2 * 5 + 4 * 6 = 62
|
|
203
|
+
* const result = Matrix2x2.vectorProductRight(matrix, vector)
|
|
204
|
+
* ```
|
|
205
|
+
* @param m - The matrix to multiply.
|
|
206
|
+
* @param v - The vector to multiply.
|
|
207
|
+
* @returns The resulting vector after the right vector product.
|
|
208
|
+
* @since 1.0.0
|
|
209
|
+
*/
|
|
210
|
+
(m: Matrix2x2, v: Vector2): Vector2;
|
|
211
|
+
/**
|
|
212
|
+
* Calculates the right vector product of a matrix and a vector.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```ts
|
|
216
|
+
* import * as Matrix2x2 from 'curvy/matrix2x2'
|
|
217
|
+
* import * as Vector2 from 'curvy/vector2'
|
|
218
|
+
*
|
|
219
|
+
* const matrix = Matrix2x2.make(1, 2, 3, 4)
|
|
220
|
+
* const vector = Vector2.make(5, 6)
|
|
221
|
+
*
|
|
222
|
+
* // Performs:
|
|
223
|
+
* // x = 1 * 5 + 3 * 6 = 33
|
|
224
|
+
* // y = 2 * 5 + 4 * 6 = 62
|
|
225
|
+
* const result = Matrix2x2.vectorProductRight(vector)(matrix)
|
|
226
|
+
* ```
|
|
227
|
+
* @param v - The vector to multiply.
|
|
228
|
+
* @returns A function that takes a matrix and returns the resulting vector after the right vector product.
|
|
229
|
+
* @since 1.0.0
|
|
230
|
+
*/
|
|
231
|
+
(v: Vector2): (m: Matrix2x2) => Vector2;
|
|
232
|
+
};
|
|
233
|
+
export declare const solveSystem: {
|
|
234
|
+
/**
|
|
235
|
+
* Solves a system of linear equations represented by a matrix and a vector.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```ts
|
|
239
|
+
* import * as Matrix2x2 from 'curvy/matrix2x2'
|
|
240
|
+
* import * as Vector2 from 'curvy/vector2'
|
|
241
|
+
*
|
|
242
|
+
* const matrix = Matrix2x2.make(1, 2, 3, 4)
|
|
243
|
+
* const vector = Vector2.make(5, 6)
|
|
244
|
+
*
|
|
245
|
+
* // Solves the system of equations:
|
|
246
|
+
* // 1x + 2y = 5
|
|
247
|
+
* // 3x + 4y = 6
|
|
248
|
+
* const result = Matrix2x2.solveSystem(matrix, vector)
|
|
249
|
+
* ```
|
|
250
|
+
* @param m - The matrix representing the coefficients of the system.
|
|
251
|
+
* @param v - The vector representing the constants of the system.
|
|
252
|
+
* @returns The solution vector.
|
|
253
|
+
* @since 1.0.0
|
|
254
|
+
*/
|
|
255
|
+
(m: Matrix2x2, v: Vector2): Vector2;
|
|
256
|
+
/**
|
|
257
|
+
* Solves a system of linear equations represented by a matrix and a vector.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* import * as Matrix2x2 from 'curvy/matrix2x2'
|
|
262
|
+
* import * as Vector2 from 'curvy/vector2'
|
|
263
|
+
*
|
|
264
|
+
* const matrix = Matrix2x2.make(1, 2, 3, 4)
|
|
265
|
+
* const vector = Vector2.make(5, 6)
|
|
266
|
+
*
|
|
267
|
+
* // Solves the system of equations:
|
|
268
|
+
* // 1x + 2y = 5
|
|
269
|
+
* // 3x + 4y = 6
|
|
270
|
+
* const result = Matrix2x2.solveSystem(vector)(matrix)
|
|
271
|
+
* ```
|
|
272
|
+
* @param v - The vector representing the constants of the system.
|
|
273
|
+
* @returns A function that takes a matrix and returns the solution vector.
|
|
274
|
+
* @since 1.0.0
|
|
275
|
+
*/
|
|
276
|
+
(v: Vector2): (m: Matrix2x2) => Vector2;
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Returns the rows of a matrix as an array of vectors.
|
|
280
|
+
*
|
|
281
|
+
* @param m - The matrix to convert.
|
|
282
|
+
* @returns An array of vectors representing the rows of the matrix.
|
|
283
|
+
* @since 1.0.0
|
|
284
|
+
*/
|
|
285
|
+
export declare const toRows: (m: Matrix2x2) => [Vector2, Vector2];
|
|
286
|
+
/**
|
|
287
|
+
* Returns the columns of a matrix as an array of vectors.
|
|
288
|
+
*
|
|
289
|
+
* @param m - The matrix to convert.
|
|
290
|
+
* @returns An array of vectors representing the columns of the matrix.
|
|
291
|
+
* @since 1.0.0
|
|
292
|
+
*/
|
|
293
|
+
export declare const toColumns: (m: Matrix2x2) => [Vector2, Vector2];
|
|
294
|
+
/**
|
|
295
|
+
* Returns the specified row of a matrix as a vector.
|
|
296
|
+
*
|
|
297
|
+
* @param m - The matrix to get the row from.
|
|
298
|
+
* @param row - The row index (0 or 1).
|
|
299
|
+
* @returns A vector representing the specified row of the matrix.
|
|
300
|
+
* @since 1.0.0
|
|
301
|
+
*/
|
|
302
|
+
export declare const rowVector: (m: Matrix2x2, row: Matrix2x2Coordinate) => Vector2;
|
|
303
|
+
/**
|
|
304
|
+
* Returns the specified column of a matrix as a vector.
|
|
305
|
+
*
|
|
306
|
+
* @param m - The matrix to get the column from.
|
|
307
|
+
* @param column - The column index (0 or 1).
|
|
308
|
+
* @returns A vector representing the specified column of the matrix.
|
|
309
|
+
* @since 1.0.0
|
|
310
|
+
*/
|
|
311
|
+
export declare const columnVector: (m: Matrix2x2, column: Matrix2x2Coordinate) => Vector2;
|
|
312
|
+
/**
|
|
313
|
+
* Transposes a matrix.
|
|
314
|
+
*
|
|
315
|
+
* @param m - The matrix to transpose.
|
|
316
|
+
* @returns A new `Matrix2x2` instance representing the transposed matrix.
|
|
317
|
+
* @since 1.0.0
|
|
318
|
+
*/
|
|
319
|
+
export declare const transpose: (m: Matrix2x2) => Matrix2x2;
|
|
320
|
+
/**
|
|
321
|
+
* Reverses the rows of a matrix.
|
|
322
|
+
*
|
|
323
|
+
* @param m - The matrix to reverse the rows of.
|
|
324
|
+
* @returns A new `Matrix2x2` instance with the rows reversed.
|
|
325
|
+
* @since 1.0.0
|
|
326
|
+
*/
|
|
327
|
+
export declare const reverseRows: (m: Matrix2x2) => Matrix2x2;
|
|
328
|
+
/**
|
|
329
|
+
* Reverses the columns of a matrix.
|
|
330
|
+
*
|
|
331
|
+
* @param m - The matrix to reverse the columns of.
|
|
332
|
+
* @returns A new `Matrix2x2` instance with the columns reversed.
|
|
333
|
+
* @since 1.0.0
|
|
334
|
+
*/
|
|
335
|
+
export declare const reverseColumns: (m: Matrix2x2) => Matrix2x2;
|