@pawells/math-extended 1.0.5 → 2.0.0
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/README.md +5 -5
- package/build/angles.d.ts +43 -3
- package/build/angles.d.ts.map +1 -1
- package/build/angles.js +61 -34
- package/build/angles.js.map +1 -1
- package/build/clamp.d.ts +5 -3
- package/build/clamp.d.ts.map +1 -1
- package/build/clamp.js +5 -3
- package/build/clamp.js.map +1 -1
- package/build/interpolation.d.ts +444 -67
- package/build/interpolation.d.ts.map +1 -1
- package/build/interpolation.js +444 -67
- package/build/interpolation.js.map +1 -1
- package/build/matrices/_exports.d.ts +13 -0
- package/build/matrices/_exports.d.ts.map +1 -0
- package/build/matrices/_exports.js +13 -0
- package/build/matrices/_exports.js.map +1 -0
- package/build/matrices/arithmetic.d.ts +170 -181
- package/build/matrices/arithmetic.d.ts.map +1 -1
- package/build/matrices/arithmetic.js +192 -202
- package/build/matrices/arithmetic.js.map +1 -1
- package/build/matrices/asserts.d.ts +244 -116
- package/build/matrices/asserts.d.ts.map +1 -1
- package/build/matrices/asserts.js +291 -94
- package/build/matrices/asserts.js.map +1 -1
- package/build/matrices/core.d.ts +40 -41
- package/build/matrices/core.d.ts.map +1 -1
- package/build/matrices/core.js +12 -13
- package/build/matrices/core.js.map +1 -1
- package/build/matrices/decompositions.d.ts +121 -124
- package/build/matrices/decompositions.d.ts.map +1 -1
- package/build/matrices/decompositions.js +168 -226
- package/build/matrices/decompositions.js.map +1 -1
- package/build/matrices/index.d.ts +3 -2
- package/build/matrices/index.d.ts.map +1 -1
- package/build/matrices/index.js +5 -2
- package/build/matrices/index.js.map +1 -1
- package/build/matrices/linear-algebra.d.ts +18 -13
- package/build/matrices/linear-algebra.d.ts.map +1 -1
- package/build/matrices/linear-algebra.js +58 -23
- package/build/matrices/linear-algebra.js.map +1 -1
- package/build/matrices/normalization.d.ts +8 -8
- package/build/matrices/transformations.d.ts +184 -168
- package/build/matrices/transformations.d.ts.map +1 -1
- package/build/matrices/transformations.js +99 -83
- package/build/matrices/transformations.js.map +1 -1
- package/build/matrices/types.d.ts +12 -12
- package/build/matrices/types.d.ts.map +1 -1
- package/build/quaternions/_exports.d.ts +11 -0
- package/build/quaternions/_exports.d.ts.map +1 -0
- package/build/quaternions/_exports.js +11 -0
- package/build/quaternions/_exports.js.map +1 -0
- package/build/quaternions/asserts.d.ts +115 -7
- package/build/quaternions/asserts.d.ts.map +1 -1
- package/build/quaternions/asserts.js +162 -8
- package/build/quaternions/asserts.js.map +1 -1
- package/build/quaternions/conversions.d.ts +31 -21
- package/build/quaternions/conversions.d.ts.map +1 -1
- package/build/quaternions/conversions.js +28 -18
- package/build/quaternions/conversions.js.map +1 -1
- package/build/quaternions/core.d.ts +73 -41
- package/build/quaternions/core.d.ts.map +1 -1
- package/build/quaternions/core.js +84 -49
- package/build/quaternions/core.js.map +1 -1
- package/build/quaternions/index.d.ts +3 -2
- package/build/quaternions/index.d.ts.map +1 -1
- package/build/quaternions/index.js +5 -2
- package/build/quaternions/index.js.map +1 -1
- package/build/quaternions/interpolation.d.ts +15 -9
- package/build/quaternions/interpolation.d.ts.map +1 -1
- package/build/quaternions/interpolation.js +15 -9
- package/build/quaternions/interpolation.js.map +1 -1
- package/build/quaternions/predefined.d.ts +9 -3
- package/build/quaternions/predefined.d.ts.map +1 -1
- package/build/quaternions/predefined.js +9 -3
- package/build/quaternions/predefined.js.map +1 -1
- package/build/quaternions/types.d.ts +3 -3
- package/build/random.d.ts +5 -2
- package/build/random.d.ts.map +1 -1
- package/build/random.js +20 -17
- package/build/random.js.map +1 -1
- package/build/vectors/_exports.d.ts +10 -0
- package/build/vectors/_exports.d.ts.map +1 -0
- package/build/vectors/_exports.js +10 -0
- package/build/vectors/_exports.js.map +1 -0
- package/build/vectors/asserts.d.ts +153 -49
- package/build/vectors/asserts.d.ts.map +1 -1
- package/build/vectors/asserts.js +202 -52
- package/build/vectors/asserts.js.map +1 -1
- package/build/vectors/core.d.ts +216 -137
- package/build/vectors/core.d.ts.map +1 -1
- package/build/vectors/core.js +217 -158
- package/build/vectors/core.js.map +1 -1
- package/build/vectors/index.d.ts +1 -0
- package/build/vectors/index.d.ts.map +1 -1
- package/build/vectors/index.js +3 -0
- package/build/vectors/index.js.map +1 -1
- package/build/vectors/interpolation.d.ts +39 -27
- package/build/vectors/interpolation.d.ts.map +1 -1
- package/build/vectors/interpolation.js +39 -27
- package/build/vectors/interpolation.js.map +1 -1
- package/build/vectors/predefined.d.ts +48 -24
- package/build/vectors/predefined.d.ts.map +1 -1
- package/build/vectors/predefined.js +38 -18
- package/build/vectors/predefined.js.map +1 -1
- package/package.json +12 -15
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAssertException } from '@pawells/typescript-common';
|
|
2
|
-
import {
|
|
2
|
+
import { TMatrix, TMatrix1, TMatrix2, TMatrix3, TMatrix4 } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Configuration options for matrix validation constraints.
|
|
5
5
|
*
|
|
@@ -9,19 +9,18 @@ import { IMatrix, IMatrix1, IMatrix2, IMatrix3, IMatrix4 } from './types.js';
|
|
|
9
9
|
*
|
|
10
10
|
* @interface IAssertMatrixArgs
|
|
11
11
|
* @example
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* ```
|
|
12
|
+
* ```typescript
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Validate a square matrix of any size
|
|
15
|
+
* const squareArgs: IAssertMatrixArgs = { square: true };
|
|
16
|
+
* // Validate minimum dimensions
|
|
17
|
+
* const minSizeArgs: IAssertMatrixArgs = { minRows: 2, minColumns: 3 };
|
|
18
|
+
* // Validate exact size using tuple
|
|
19
|
+
* const exactSizeArgs: IAssertMatrixArgs = { size: [4, 5] };
|
|
20
|
+
* // Validate square matrix with exact size
|
|
21
|
+
* const squareExactArgs: IAssertMatrixArgs = { square: true, size: 3 };
|
|
22
|
+
* ```
|
|
23
|
+
* ```
|
|
25
24
|
*/
|
|
26
25
|
interface IAssertMatrixArgs {
|
|
27
26
|
/** Minimum number of rows required in the matrix */
|
|
@@ -55,15 +54,16 @@ interface IAssertMatrixArgs {
|
|
|
55
54
|
*
|
|
56
55
|
* @interface IAssertMatricesArgs
|
|
57
56
|
* @example
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
* ```typescript
|
|
58
|
+
* ```typescript
|
|
59
|
+
* // Standard compatibility (same dimensions for addition/subtraction)
|
|
60
|
+
* const standardArgs: IAssertMatricesArgs = {};
|
|
61
|
+
* // Allow transposed compatibility for multiplication
|
|
62
|
+
* const transposedArgs: IAssertMatricesArgs = { transposition: true };
|
|
63
|
+
* ```
|
|
64
|
+
* ```
|
|
65
65
|
*/
|
|
66
|
-
interface IAssertMatricesArgs {
|
|
66
|
+
export interface IAssertMatricesArgs {
|
|
67
67
|
/**
|
|
68
68
|
* Whether to allow transposed dimensions between matrices.
|
|
69
69
|
* When true, matrices A (m×n) and B (n×m) are considered compatible.
|
|
@@ -98,26 +98,33 @@ interface IAssertMatrixException extends IAssertException {
|
|
|
98
98
|
* @class MatrixError
|
|
99
99
|
* @extends Error
|
|
100
100
|
* @example
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
* ```typescript
|
|
102
|
+
* ```typescript
|
|
103
|
+
* try {
|
|
104
|
+
* AssertMatrix(invalidMatrix);
|
|
105
|
+
* } catch (error) {
|
|
106
|
+
* if (error instanceof MatrixError) {
|
|
107
|
+
* console.log('Matrix validation failed:', error.message);
|
|
108
|
+
* }
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
* ```
|
|
110
112
|
*/
|
|
111
113
|
export declare class MatrixError extends Error {
|
|
114
|
+
readonly code: string;
|
|
112
115
|
/**
|
|
113
116
|
* Creates a new MatrixError instance.
|
|
114
117
|
*
|
|
115
|
-
* @param message -
|
|
118
|
+
* @param message - Error message describing the validation failure
|
|
119
|
+
* @param options - Optional error context
|
|
120
|
+
* @param options.cause - Original error that caused this error
|
|
116
121
|
*/
|
|
117
|
-
constructor(message?:
|
|
122
|
+
constructor(message: string, options?: {
|
|
123
|
+
cause?: unknown;
|
|
124
|
+
});
|
|
118
125
|
}
|
|
119
126
|
/**
|
|
120
|
-
* Validates that an unknown value is a valid matrix conforming to the
|
|
127
|
+
* Validates that an unknown value is a valid matrix conforming to the TMatrix interface.
|
|
121
128
|
*
|
|
122
129
|
* This function performs comprehensive validation of matrix structure including:
|
|
123
130
|
* - Type checking to ensure the value is a proper matrix
|
|
@@ -131,18 +138,18 @@ export declare class MatrixError extends Error {
|
|
|
131
138
|
* @throws {IAssertException} When the matrix doesn't meet the specified criteria
|
|
132
139
|
*
|
|
133
140
|
* @example
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
* ```typescript
|
|
142
|
+
* ```typescript
|
|
143
|
+
* // Validate a 3x3 square matrix
|
|
144
|
+
* AssertMatrix(someValue, { square: true, size: 3 });
|
|
145
|
+
* // Validate minimum dimensions
|
|
146
|
+
* AssertMatrix(someValue, { minRows: 2, minColumns: 3 });
|
|
147
|
+
* // Validate exact dimensions
|
|
148
|
+
* AssertMatrix(someValue, { rows: 4, columns: 5 });
|
|
149
|
+
* ```
|
|
150
|
+
* ```
|
|
144
151
|
*/
|
|
145
|
-
export declare function AssertMatrix(matrix: unknown, args?: IAssertMatrixArgs, exception?: IAssertMatrixException): asserts matrix is
|
|
152
|
+
export declare function AssertMatrix(matrix: unknown, args?: IAssertMatrixArgs, exception?: IAssertMatrixException): asserts matrix is TMatrix;
|
|
146
153
|
/**
|
|
147
154
|
* Validates that an unknown value is a valid matrix row (array of numbers).
|
|
148
155
|
*
|
|
@@ -150,21 +157,20 @@ export declare function AssertMatrix(matrix: unknown, args?: IAssertMatrixArgs,
|
|
|
150
157
|
* which should be an array containing only numeric values.
|
|
151
158
|
*
|
|
152
159
|
* @param row - The value to validate as a matrix row
|
|
153
|
-
* @param exception - Custom exception details
|
|
154
|
-
* @
|
|
155
|
-
* @throws {IAssertException} When the row is not a valid array of numbers
|
|
160
|
+
* @param exception - Custom exception details (optionally includes `rowIndex` for richer messages)
|
|
161
|
+
* @throws {MatrixError} When the row is not a valid array of finite numbers
|
|
156
162
|
*
|
|
157
163
|
* @example
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
* ```typescript
|
|
165
|
+
* ```typescript
|
|
166
|
+
* // Validate a matrix row
|
|
167
|
+
* AssertMatrixRow([1, 2, 3, 4]);
|
|
168
|
+
* // Validate with row index in exception for better error messages
|
|
169
|
+
* AssertMatrixRow([1, 2, 3, 4], { rowIndex: 0 });
|
|
170
|
+
* // This would throw MatrixError
|
|
171
|
+
* AssertMatrixRow([1, '2', 3]); // Contains non-numeric value
|
|
172
|
+
* ```
|
|
173
|
+
* ```
|
|
168
174
|
*/
|
|
169
175
|
export declare function AssertMatrixRow(row: unknown, exception?: IAssertMatrixException): asserts row is number[];
|
|
170
176
|
/**
|
|
@@ -174,24 +180,22 @@ export declare function AssertMatrixRow(row: unknown, exception?: IAssertMatrixE
|
|
|
174
180
|
* which should be a finite number (not NaN, Infinity, or -Infinity).
|
|
175
181
|
*
|
|
176
182
|
* @param value - The value to validate as a matrix element
|
|
177
|
-
* @param exception - Custom exception details
|
|
178
|
-
* @
|
|
179
|
-
* @param columnIndex - Optional column index for more descriptive error messages
|
|
180
|
-
* @throws {IAssertException} When the value is not a finite number
|
|
183
|
+
* @param exception - Custom exception details (optionally includes `rowIndex` and `columnIndex` for richer messages)
|
|
184
|
+
* @throws {MatrixError} When the value is not a finite number
|
|
181
185
|
*
|
|
182
186
|
* @example
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
187
|
+
* ```typescript
|
|
188
|
+
* ```typescript
|
|
189
|
+
* // Validate a matrix element
|
|
190
|
+
* AssertMatrixValue(42);
|
|
191
|
+
* // Validate with position information for better error messages
|
|
192
|
+
* AssertMatrixValue(3.14, { rowIndex: 0, columnIndex: 1 });
|
|
193
|
+
* // These would throw MatrixError
|
|
194
|
+
* AssertMatrixValue(NaN); // Not a number
|
|
195
|
+
* AssertMatrixValue(Infinity); // Not a finite number
|
|
196
|
+
* AssertMatrixValue('5'); // Not a number type
|
|
197
|
+
* ```
|
|
198
|
+
* ```
|
|
195
199
|
*/
|
|
196
200
|
export declare function AssertMatrixValue(value: unknown, exception?: IAssertMatrixException): asserts value is number;
|
|
197
201
|
/**
|
|
@@ -208,13 +212,14 @@ export declare function AssertMatrixValue(value: unknown, exception?: IAssertMat
|
|
|
208
212
|
* @throws {IAssertException} When the matrices are not compatible
|
|
209
213
|
*
|
|
210
214
|
* @example
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
* ```typescript
|
|
216
|
+
* ```typescript
|
|
217
|
+
* // Validate matrices for multiplication (A columns must equal B rows)
|
|
218
|
+
* AssertMatrices(matrixA, matrixB);
|
|
219
|
+
* // Allow transposed compatibility
|
|
220
|
+
* AssertMatrices(matrixA, matrixB, { transposition: true });
|
|
221
|
+
* ```
|
|
222
|
+
* ```
|
|
218
223
|
*/
|
|
219
224
|
export declare function AssertMatrices(a: unknown, b: unknown, args?: IAssertMatricesArgs, exception?: IAssertMatrixException): void;
|
|
220
225
|
/**
|
|
@@ -228,15 +233,16 @@ export declare function AssertMatrices(a: unknown, b: unknown, args?: IAssertMat
|
|
|
228
233
|
* @throws {IAssertException} When the matrix is not a valid 1x1 matrix
|
|
229
234
|
*
|
|
230
235
|
* @example
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
* ```typescript
|
|
237
|
+
* ```typescript
|
|
238
|
+
* // Validate a 1x1 matrix
|
|
239
|
+
* AssertMatrix1([[5]]);
|
|
240
|
+
* // This would throw an exception
|
|
241
|
+
* AssertMatrix1([[1, 2]]); // Too many columns
|
|
242
|
+
* ```
|
|
243
|
+
* ```
|
|
238
244
|
*/
|
|
239
|
-
export declare function AssertMatrix1(matrix: unknown, exception?: IAssertMatrixException): asserts matrix is
|
|
245
|
+
export declare function AssertMatrix1(matrix: unknown, exception?: IAssertMatrixException): asserts matrix is TMatrix1;
|
|
240
246
|
/**
|
|
241
247
|
* Validates that an unknown value is a valid 2x2 matrix.
|
|
242
248
|
*
|
|
@@ -248,15 +254,16 @@ export declare function AssertMatrix1(matrix: unknown, exception?: IAssertMatrix
|
|
|
248
254
|
* @throws {IAssertException} When the matrix is not a valid 2x2 matrix
|
|
249
255
|
*
|
|
250
256
|
* @example
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
257
|
+
* ```typescript
|
|
258
|
+
* ```typescript
|
|
259
|
+
* // Validate a 2x2 matrix
|
|
260
|
+
* AssertMatrix2([[1, 2], [3, 4]]);
|
|
261
|
+
* // This would throw an exception
|
|
262
|
+
* AssertMatrix2([[1, 2, 3], [4, 5, 6]]); // Too many columns
|
|
263
|
+
* ```
|
|
264
|
+
* ```
|
|
258
265
|
*/
|
|
259
|
-
export declare function AssertMatrix2(matrix: unknown, exception?: IAssertMatrixException): asserts matrix is
|
|
266
|
+
export declare function AssertMatrix2(matrix: unknown, exception?: IAssertMatrixException): asserts matrix is TMatrix2;
|
|
260
267
|
/**
|
|
261
268
|
* Validates that an unknown value is a valid 3x3 matrix.
|
|
262
269
|
*
|
|
@@ -268,15 +275,16 @@ export declare function AssertMatrix2(matrix: unknown, exception?: IAssertMatrix
|
|
|
268
275
|
* @throws {IAssertException} When the matrix is not a valid 3x3 matrix
|
|
269
276
|
*
|
|
270
277
|
* @example
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
+
* ```typescript
|
|
279
|
+
* ```typescript
|
|
280
|
+
* // Validate a 3x3 matrix
|
|
281
|
+
* AssertMatrix3([[1, 2, 3], [4, 5, 6], [7, 8, 9]]);
|
|
282
|
+
* // This would throw an exception
|
|
283
|
+
* AssertMatrix3([[1, 2], [3, 4]]); // Too few rows and columns
|
|
284
|
+
* ```
|
|
285
|
+
* ```
|
|
278
286
|
*/
|
|
279
|
-
export declare function AssertMatrix3(matrix: unknown, exception?: IAssertMatrixException): asserts matrix is
|
|
287
|
+
export declare function AssertMatrix3(matrix: unknown, exception?: IAssertMatrixException): asserts matrix is TMatrix3;
|
|
280
288
|
/**
|
|
281
289
|
* Validates that an unknown value is a valid 4x4 matrix.
|
|
282
290
|
*
|
|
@@ -287,20 +295,140 @@ export declare function AssertMatrix3(matrix: unknown, exception?: IAssertMatrix
|
|
|
287
295
|
* @param exception - Custom exception details if validation fails
|
|
288
296
|
* @throws {IAssertException} When the matrix is not a valid 4x4 matrix
|
|
289
297
|
*
|
|
298
|
+
* @example
|
|
299
|
+
* ```typescript
|
|
300
|
+
* ```typescript
|
|
301
|
+
* // Validate a 4x4 matrix
|
|
302
|
+
* AssertMatrix4([
|
|
303
|
+
* [1, 2, 3, 4],
|
|
304
|
+
* [5, 6, 7, 8],
|
|
305
|
+
* [9, 10, 11, 12],
|
|
306
|
+
* [13, 14, 15, 16]
|
|
307
|
+
* ]);
|
|
308
|
+
* // This would throw an exception
|
|
309
|
+
* AssertMatrix4([[1, 2], [3, 4]]); // Too few rows and columns
|
|
310
|
+
* ```
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
export declare function AssertMatrix4(matrix: unknown, exception?: IAssertMatrixException): asserts matrix is TMatrix4;
|
|
314
|
+
/**
|
|
315
|
+
* Validates that an unknown value is a valid matrix without throwing an error.
|
|
316
|
+
*
|
|
317
|
+
* This function performs the same validation as AssertMatrix but returns
|
|
318
|
+
* a boolean instead of throwing an exception, making it suitable for
|
|
319
|
+
* conditional logic where exceptions are not desired.
|
|
320
|
+
*
|
|
321
|
+
* @param matrix - The value to validate as a matrix
|
|
322
|
+
* @param args - Validation configuration options
|
|
323
|
+
* @returns true if the matrix is valid, false otherwise
|
|
324
|
+
*
|
|
290
325
|
* @example
|
|
291
326
|
* ```typescript
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
327
|
+
* if (ValidateMatrix(someValue, { square: true })) {
|
|
328
|
+
* // Process the valid square matrix
|
|
329
|
+
* }
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
export declare function ValidateMatrix(matrix: unknown, args?: IAssertMatrixArgs): matrix is TMatrix;
|
|
333
|
+
/**
|
|
334
|
+
* Validates that an unknown value is a valid 1×1 matrix without throwing an error.
|
|
335
|
+
*
|
|
336
|
+
* @param matrix - The value to validate as a 1×1 matrix
|
|
337
|
+
* @returns true if the matrix is valid, false otherwise
|
|
338
|
+
*
|
|
339
|
+
* @example
|
|
340
|
+
* ```typescript
|
|
341
|
+
* if (ValidateMatrix1(someValue)) {
|
|
342
|
+
* // Process the valid 1×1 matrix
|
|
343
|
+
* }
|
|
344
|
+
* ```
|
|
345
|
+
*/
|
|
346
|
+
export declare function ValidateMatrix1(matrix: unknown): matrix is TMatrix1;
|
|
347
|
+
/**
|
|
348
|
+
* Validates that an unknown value is a valid 2×2 matrix without throwing an error.
|
|
349
|
+
*
|
|
350
|
+
* @param matrix - The value to validate as a 2×2 matrix
|
|
351
|
+
* @returns true if the matrix is valid, false otherwise
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* ```typescript
|
|
355
|
+
* if (ValidateMatrix2(someValue)) {
|
|
356
|
+
* // Process the valid 2×2 matrix
|
|
357
|
+
* }
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
export declare function ValidateMatrix2(matrix: unknown): matrix is TMatrix2;
|
|
361
|
+
/**
|
|
362
|
+
* Validates that an unknown value is a valid 3×3 matrix without throwing an error.
|
|
363
|
+
*
|
|
364
|
+
* @param matrix - The value to validate as a 3×3 matrix
|
|
365
|
+
* @returns true if the matrix is valid, false otherwise
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```typescript
|
|
369
|
+
* if (ValidateMatrix3(someValue)) {
|
|
370
|
+
* // Process the valid 3×3 matrix
|
|
371
|
+
* }
|
|
372
|
+
* ```
|
|
373
|
+
*/
|
|
374
|
+
export declare function ValidateMatrix3(matrix: unknown): matrix is TMatrix3;
|
|
375
|
+
/**
|
|
376
|
+
* Validates that an unknown value is a valid 4×4 matrix without throwing an error.
|
|
377
|
+
*
|
|
378
|
+
* @param matrix - The value to validate as a 4×4 matrix
|
|
379
|
+
* @returns true if the matrix is valid, false otherwise
|
|
380
|
+
*
|
|
381
|
+
* @example
|
|
382
|
+
* ```typescript
|
|
383
|
+
* if (ValidateMatrix4(someValue)) {
|
|
384
|
+
* // Process the valid 4×4 matrix
|
|
385
|
+
* }
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
export declare function ValidateMatrix4(matrix: unknown): matrix is TMatrix4;
|
|
389
|
+
/**
|
|
390
|
+
* Validates that an unknown value is a valid matrix row without throwing an error.
|
|
391
|
+
*
|
|
392
|
+
* @param row - The value to validate as a matrix row
|
|
393
|
+
* @returns true if the row is valid, false otherwise
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* ```typescript
|
|
397
|
+
* if (ValidateMatrixRow([1, 2, 3])) {
|
|
398
|
+
* // Process the valid row
|
|
399
|
+
* }
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
402
|
+
export declare function ValidateMatrixRow(row: unknown): row is number[];
|
|
403
|
+
/**
|
|
404
|
+
* Validates that an unknown value is a valid matrix value (finite number) without throwing an error.
|
|
405
|
+
*
|
|
406
|
+
* @param value - The value to validate as a matrix element
|
|
407
|
+
* @returns true if the value is valid, false otherwise
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```typescript
|
|
411
|
+
* if (ValidateMatrixValue(someValue)) {
|
|
412
|
+
* // Process the valid numeric value
|
|
413
|
+
* }
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
416
|
+
export declare function ValidateMatrixValue(value: unknown): value is number;
|
|
417
|
+
/**
|
|
418
|
+
* Validates that two unknown values are compatible matrices without throwing an error.
|
|
419
|
+
*
|
|
420
|
+
* @param a - The first matrix to validate
|
|
421
|
+
* @param b - The second matrix to validate
|
|
422
|
+
* @param args - Validation configuration options
|
|
423
|
+
* @returns true if both matrices are valid and compatible, false otherwise
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* ```typescript
|
|
427
|
+
* if (ValidateMatrices(matrixA, matrixB, { transposition: true })) {
|
|
428
|
+
* // Process the valid and compatible matrices
|
|
429
|
+
* }
|
|
302
430
|
* ```
|
|
303
431
|
*/
|
|
304
|
-
export declare function
|
|
432
|
+
export declare function ValidateMatrices(a: unknown, b: unknown, args?: IAssertMatricesArgs): boolean;
|
|
305
433
|
export {};
|
|
306
434
|
//# sourceMappingURL=asserts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asserts.d.ts","sourceRoot":"","sources":["../../src/matrices/asserts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,gBAAgB,EAAwE,MAAM,4BAA4B,CAAC;AACnJ,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG7E
|
|
1
|
+
{"version":3,"file":"asserts.d.ts","sourceRoot":"","sources":["../../src/matrices/asserts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,gBAAgB,EAAwE,MAAM,4BAA4B,CAAC;AACnJ,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG7E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,UAAU,iBAAiB;IAC1B,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC;CACjC;AACD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AACD;;;;;;;;;GASG;AACH,UAAU,sBAAuB,SAAQ,gBAAgB;IACxD,qGAAqG;IACrG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2GAA2G;IAC3G,WAAW,CAAC,EAAE,MAAM,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