@pawells/math-extended 1.1.1 → 3.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 +15 -21
- package/build/angles.d.ts +28 -18
- package/build/angles.d.ts.map +1 -1
- package/build/angles.js +28 -18
- package/build/angles.js.map +1 -1
- package/build/clamp.d.ts +2 -0
- package/build/clamp.d.ts.map +1 -1
- package/build/clamp.js +2 -0
- package/build/clamp.js.map +1 -1
- package/build/core.d.ts +23 -0
- package/build/core.d.ts.map +1 -0
- package/build/core.js +25 -0
- package/build/core.js.map +1 -0
- package/build/index.d.ts +1 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -6
- package/build/index.js.map +1 -1
- package/build/interpolation.d.ts +62 -13
- package/build/interpolation.d.ts.map +1 -1
- package/build/interpolation.js +66 -23
- package/build/interpolation.js.map +1 -1
- package/build/matrices/arithmetic.d.ts +65 -76
- package/build/matrices/arithmetic.d.ts.map +1 -1
- package/build/matrices/arithmetic.js +65 -107
- package/build/matrices/arithmetic.js.map +1 -1
- package/build/matrices/asserts.d.ts +26 -273
- package/build/matrices/asserts.d.ts.map +1 -1
- package/build/matrices/asserts.js +106 -350
- package/build/matrices/asserts.js.map +1 -1
- package/build/matrices/core.d.ts +150 -79
- package/build/matrices/core.d.ts.map +1 -1
- package/build/matrices/core.js +128 -104
- package/build/matrices/core.js.map +1 -1
- package/build/matrices/decompositions.d.ts +41 -44
- package/build/matrices/decompositions.d.ts.map +1 -1
- package/build/matrices/decompositions.js +51 -94
- package/build/matrices/decompositions.js.map +1 -1
- package/build/matrices/index.d.ts +2 -2
- package/build/matrices/index.d.ts.map +1 -1
- package/build/matrices/index.js +2 -2
- package/build/matrices/index.js.map +1 -1
- package/build/matrices/linear-algebra.d.ts +56 -19
- package/build/matrices/linear-algebra.d.ts.map +1 -1
- package/build/matrices/linear-algebra.js +80 -36
- package/build/matrices/linear-algebra.js.map +1 -1
- package/build/matrices/normalization.d.ts +36 -15
- package/build/matrices/normalization.d.ts.map +1 -1
- package/build/matrices/normalization.js +32 -23
- package/build/matrices/normalization.js.map +1 -1
- package/build/matrices/transformations.d.ts +39 -52
- package/build/matrices/transformations.d.ts.map +1 -1
- package/build/matrices/transformations.js +8 -11
- package/build/matrices/transformations.js.map +1 -1
- package/build/matrices/types.d.ts +39 -67
- package/build/matrices/types.d.ts.map +1 -1
- package/build/matrices/types.js +63 -1
- package/build/matrices/types.js.map +1 -1
- package/build/quaternions/asserts.d.ts +114 -15
- package/build/quaternions/asserts.d.ts.map +1 -1
- package/build/quaternions/asserts.js +189 -51
- package/build/quaternions/asserts.js.map +1 -1
- package/build/quaternions/conversions.d.ts +18 -8
- package/build/quaternions/conversions.d.ts.map +1 -1
- package/build/quaternions/conversions.js +14 -4
- package/build/quaternions/conversions.js.map +1 -1
- package/build/quaternions/core.d.ts +31 -2
- package/build/quaternions/core.d.ts.map +1 -1
- package/build/quaternions/core.js +32 -4
- package/build/quaternions/core.js.map +1 -1
- package/build/quaternions/index.d.ts +2 -2
- package/build/quaternions/index.d.ts.map +1 -1
- package/build/quaternions/index.js +3 -2
- package/build/quaternions/index.js.map +1 -1
- package/build/quaternions/interpolation.d.ts +7 -1
- package/build/quaternions/interpolation.d.ts.map +1 -1
- package/build/quaternions/interpolation.js +12 -6
- package/build/quaternions/interpolation.js.map +1 -1
- package/build/quaternions/predefined.d.ts +7 -1
- package/build/quaternions/predefined.d.ts.map +1 -1
- package/build/quaternions/predefined.js +6 -0
- package/build/quaternions/predefined.js.map +1 -1
- package/build/quaternions/types.d.ts +24 -13
- package/build/quaternions/types.d.ts.map +1 -1
- package/build/quaternions/types.js +51 -1
- package/build/quaternions/types.js.map +1 -1
- package/build/random.d.ts +66 -20
- package/build/random.d.ts.map +1 -1
- package/build/random.js +73 -20
- package/build/random.js.map +1 -1
- package/build/vectors/asserts.d.ts +33 -99
- package/build/vectors/asserts.d.ts.map +1 -1
- package/build/vectors/asserts.js +145 -181
- package/build/vectors/asserts.js.map +1 -1
- package/build/vectors/core.d.ts +76 -44
- package/build/vectors/core.d.ts.map +1 -1
- package/build/vectors/core.js +128 -119
- package/build/vectors/core.js.map +1 -1
- package/build/vectors/index.d.ts.map +1 -1
- package/build/vectors/index.js +1 -0
- package/build/vectors/index.js.map +1 -1
- package/build/vectors/interpolation.d.ts +13 -1
- package/build/vectors/interpolation.d.ts.map +1 -1
- package/build/vectors/interpolation.js +48 -47
- package/build/vectors/interpolation.js.map +1 -1
- package/build/vectors/predefined.d.ts +73 -25
- package/build/vectors/predefined.d.ts.map +1 -1
- package/build/vectors/predefined.js +62 -18
- package/build/vectors/predefined.js.map +1 -1
- package/build/vectors/types.d.ts +26 -4
- package/build/vectors/types.d.ts.map +1 -1
- package/build/vectors/types.js +50 -1
- package/build/vectors/types.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ yarn add @pawells/math-extended
|
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
|
-
All exports are available as individual named imports for tree-shaking
|
|
22
|
+
All exports are available as individual named imports for tree-shaking optimization.
|
|
23
23
|
|
|
24
24
|
### Direct Named Imports (Tree-Shaking Friendly)
|
|
25
25
|
|
|
@@ -43,29 +43,22 @@ const v = SmoothStep(0, 10, 0.5); // 5
|
|
|
43
43
|
const rad = DegreesToRadians(180); // Math.PI
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
### Namespace Imports (Grouped)
|
|
47
|
-
|
|
48
|
-
Import related utilities together using namespace imports:
|
|
49
|
-
|
|
50
|
-
```typescript
|
|
51
|
-
import { VectorUtils, MatrixUtils, QuaternionUtils } from '@pawells/math-extended';
|
|
52
|
-
|
|
53
|
-
// Access utilities via namespace
|
|
54
|
-
VectorUtils.VectorAdd([1, 0, 0], [0, 1, 0]);
|
|
55
|
-
MatrixUtils.MatrixMultiply(matA, matB);
|
|
56
|
-
QuaternionUtils.QuaternionSLERP(q1, q2, 0.5);
|
|
57
|
-
```
|
|
58
46
|
|
|
59
47
|
### Import Patterns
|
|
60
48
|
|
|
61
49
|
| Pattern | Best For | Example |
|
|
62
50
|
|---------|----------|---------|
|
|
63
51
|
| **Direct named** | Tree-shaking, small imports | `import { VectorAdd } from '@pawells/math-extended'` |
|
|
64
|
-
| **
|
|
65
|
-
| **Mixed** | Flexibility | Both patterns together |
|
|
52
|
+
| **Mixed** | Flexibility | Multiple imports together |
|
|
66
53
|
|
|
67
54
|
## API
|
|
68
55
|
|
|
56
|
+
### Core
|
|
57
|
+
|
|
58
|
+
| Export | Description |
|
|
59
|
+
|--------|-------------|
|
|
60
|
+
| `CubeRoot(value)` | Compute the cube root of a number |
|
|
61
|
+
|
|
69
62
|
### Angles
|
|
70
63
|
|
|
71
64
|
| Export | Description |
|
|
@@ -106,7 +99,7 @@ All interpolation functions share the signature `(a, b, t)`. `t` is typically in
|
|
|
106
99
|
| `CosineInterpolation` | Cosine interpolation |
|
|
107
100
|
| `CatmullRomInterpolation` | Catmull-Rom spline `(p0, p1, p2, p3, t)` |
|
|
108
101
|
| `HermiteInterpolation` | Hermite spline `(p0, p1, t0, t1, t)` |
|
|
109
|
-
| `SphericalLinearInterpolation` |
|
|
102
|
+
| `SphericalLinearInterpolation` | **@deprecated** Identical to `LinearInterpolation`. Use `QuaternionSLERP` for true spherical interpolation. |
|
|
110
103
|
| `StepInterpolation` | Step function with configurable threshold |
|
|
111
104
|
| `QuadraticEaseIn/Out/InOut` | Quadratic easing |
|
|
112
105
|
| `CubicEaseIn/Out/InOut` | Cubic easing |
|
|
@@ -172,11 +165,11 @@ Every scalar easing function has a `Vector*` counterpart (e.g., `VectorSmoothSte
|
|
|
172
165
|
|
|
173
166
|
#### Assertions
|
|
174
167
|
|
|
175
|
-
`AssertVector`, `AssertVector2`, `AssertVector3`, `AssertVector4`, `
|
|
168
|
+
`AssertVector`, `AssertVector2`, `AssertVector3`, `AssertVector4`, `AssertVectorNonZero`, `AssertVectorSameSize`, `ValidateVector`, `ValidateVector2`, `ValidateVector3`, `ValidateVector4`, `ValidateVectorSameSize`, `VectorError`
|
|
176
169
|
|
|
177
170
|
### Matrices
|
|
178
171
|
|
|
179
|
-
Matrices are `number[][]` arrays (`
|
|
172
|
+
Matrices are `number[][]` arrays (`TMatrix`, `TMatrix1`–`TMatrix4`). All operations return new matrices.
|
|
180
173
|
|
|
181
174
|
#### Core
|
|
182
175
|
|
|
@@ -266,7 +259,7 @@ Matrices are `number[][]` arrays (`IMatrix`, `IMatrix1`–`IMatrix4`). All opera
|
|
|
266
259
|
|
|
267
260
|
#### Assertions
|
|
268
261
|
|
|
269
|
-
`AssertMatrix`, `AssertMatrix1`–`AssertMatrix4`, `
|
|
262
|
+
`AssertMatrix`, `AssertMatrix1`–`AssertMatrix4`, `AssertMatrixSquare`, `AssertMatricesCompatible`, `ValidateMatrix`, `ValidateMatrix1`–`ValidateMatrix4`, `ValidateMatrixSquare`, `MatrixError`
|
|
270
263
|
|
|
271
264
|
### Quaternions
|
|
272
265
|
|
|
@@ -318,6 +311,7 @@ Quaternions are `[x, y, z, w]` tuples (`TQuaternion`).
|
|
|
318
311
|
|
|
319
312
|
`AssertQuaternion`, `AssertQuaternions`, `AssertNormalizedQuaternion`, `AssertAxisAngle`, `AssertEulerAngles`, `AssertRotationMatrix`, `QuaternionError`
|
|
320
313
|
|
|
314
|
+
|
|
321
315
|
## Development
|
|
322
316
|
|
|
323
317
|
```bash
|
|
@@ -328,7 +322,7 @@ yarn watch # Watch mode
|
|
|
328
322
|
yarn typecheck # Type check without building
|
|
329
323
|
yarn lint # ESLint
|
|
330
324
|
yarn lint:fix # ESLint with auto-fix
|
|
331
|
-
yarn test # Run tests (
|
|
325
|
+
yarn test # Run tests (1137 tests)
|
|
332
326
|
yarn test:ui # Interactive Vitest UI
|
|
333
327
|
yarn test:coverage # Tests with coverage report
|
|
334
328
|
```
|
|
@@ -339,4 +333,4 @@ yarn test:coverage # Tests with coverage report
|
|
|
339
333
|
|
|
340
334
|
## License
|
|
341
335
|
|
|
342
|
-
|
|
336
|
+
This project is licensed under the [MIT License](LICENSE).
|
package/build/angles.d.ts
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* @returns Angle in radians
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
* ```typescript
|
|
8
|
+
* DegreesToRadians(180) // Math.PI
|
|
9
|
+
* DegreesToRadians(90) // Math.PI / 2
|
|
10
|
+
* DegreesToRadians(0) // 0
|
|
11
|
+
* ```
|
|
10
12
|
*/
|
|
11
13
|
export declare function DegreesToRadians(degrees: number): number;
|
|
12
14
|
/**
|
|
@@ -15,9 +17,11 @@ export declare function DegreesToRadians(degrees: number): number;
|
|
|
15
17
|
* @returns Angle in degrees
|
|
16
18
|
*
|
|
17
19
|
* @example
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
* ```typescript
|
|
21
|
+
* RadiansToDegrees(Math.PI) // 180
|
|
22
|
+
* RadiansToDegrees(Math.PI / 2) // 90
|
|
23
|
+
* RadiansToDegrees(0) // 0
|
|
24
|
+
* ```
|
|
21
25
|
*/
|
|
22
26
|
export declare function RadiansToDegrees(radians: number): number;
|
|
23
27
|
/**
|
|
@@ -26,11 +30,13 @@ export declare function RadiansToDegrees(radians: number): number;
|
|
|
26
30
|
* @returns String representation of the angle
|
|
27
31
|
*
|
|
28
32
|
* @example
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
* ```typescript
|
|
34
|
+
* FormatRadians(0) // '0'
|
|
35
|
+
* FormatRadians(Math.PI) // 'π'
|
|
36
|
+
* FormatRadians(Math.PI / 2) // 'π/2'
|
|
37
|
+
* FormatRadians(Math.PI / 4) // 'π/4'
|
|
38
|
+
* FormatRadians(-Math.PI) // '-π'
|
|
39
|
+
* ```
|
|
34
40
|
*/
|
|
35
41
|
export declare function FormatRadians(radians: number): string;
|
|
36
42
|
/**
|
|
@@ -39,9 +45,11 @@ export declare function FormatRadians(radians: number): string;
|
|
|
39
45
|
* @returns Normalized angle in radians in the range [0, 2π)
|
|
40
46
|
*
|
|
41
47
|
* @example
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
* ```typescript
|
|
49
|
+
* NormalizeRadians(3 * Math.PI) // Math.PI (wraps around)
|
|
50
|
+
* NormalizeRadians(-Math.PI) // Math.PI (negative angles normalized)
|
|
51
|
+
* NormalizeRadians(0) // 0
|
|
52
|
+
* ```
|
|
45
53
|
*/
|
|
46
54
|
export declare function NormalizeRadians(radians: number): number;
|
|
47
55
|
/**
|
|
@@ -52,10 +60,12 @@ export declare function NormalizeRadians(radians: number): number;
|
|
|
52
60
|
* @returns Normalized angle in degrees in the range [0°, 360°)
|
|
53
61
|
*
|
|
54
62
|
* @example
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
* ```typescript
|
|
64
|
+
* NormalizeDegrees(450) // 90 (wraps around 360°)
|
|
65
|
+
* NormalizeDegrees(-90) // 270 (negative angles normalized)
|
|
66
|
+
* NormalizeDegrees(0) // 0
|
|
67
|
+
* NormalizeDegrees(360 - 1e-11) // 0 (boundary epsilon snap)
|
|
68
|
+
* ```
|
|
59
69
|
*/
|
|
60
70
|
export declare function NormalizeDegrees(degrees: number): number;
|
|
61
71
|
//# sourceMappingURL=angles.d.ts.map
|
package/build/angles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angles.d.ts","sourceRoot":"","sources":["../src/angles.ts"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"angles.d.ts","sourceRoot":"","sources":["../src/angles.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAuBrD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMxD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKxD"}
|
package/build/angles.js
CHANGED
|
@@ -9,9 +9,11 @@ const NORMALIZE_EPSILON = 1e-10; // Epsilon for floating-point boundary cleanup
|
|
|
9
9
|
* @returns Angle in radians
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
* ```typescript
|
|
13
|
+
* DegreesToRadians(180) // Math.PI
|
|
14
|
+
* DegreesToRadians(90) // Math.PI / 2
|
|
15
|
+
* DegreesToRadians(0) // 0
|
|
16
|
+
* ```
|
|
15
17
|
*/
|
|
16
18
|
export function DegreesToRadians(degrees) {
|
|
17
19
|
return (degrees * Math.PI) / DEGREES_PER_HALF_REVOLUTION;
|
|
@@ -22,9 +24,11 @@ export function DegreesToRadians(degrees) {
|
|
|
22
24
|
* @returns Angle in degrees
|
|
23
25
|
*
|
|
24
26
|
* @example
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
* ```typescript
|
|
28
|
+
* RadiansToDegrees(Math.PI) // 180
|
|
29
|
+
* RadiansToDegrees(Math.PI / 2) // 90
|
|
30
|
+
* RadiansToDegrees(0) // 0
|
|
31
|
+
* ```
|
|
28
32
|
*/
|
|
29
33
|
export function RadiansToDegrees(radians) {
|
|
30
34
|
return (radians * DEGREES_PER_HALF_REVOLUTION) / Math.PI;
|
|
@@ -35,11 +39,13 @@ export function RadiansToDegrees(radians) {
|
|
|
35
39
|
* @returns String representation of the angle
|
|
36
40
|
*
|
|
37
41
|
* @example
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
* ```typescript
|
|
43
|
+
* FormatRadians(0) // '0'
|
|
44
|
+
* FormatRadians(Math.PI) // 'π'
|
|
45
|
+
* FormatRadians(Math.PI / 2) // 'π/2'
|
|
46
|
+
* FormatRadians(Math.PI / 4) // 'π/4'
|
|
47
|
+
* FormatRadians(-Math.PI) // '-π'
|
|
48
|
+
* ```
|
|
43
49
|
*/
|
|
44
50
|
export function FormatRadians(radians) {
|
|
45
51
|
const r = radians / Math.PI;
|
|
@@ -72,9 +78,11 @@ export function FormatRadians(radians) {
|
|
|
72
78
|
* @returns Normalized angle in radians in the range [0, 2π)
|
|
73
79
|
*
|
|
74
80
|
* @example
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
* ```typescript
|
|
82
|
+
* NormalizeRadians(3 * Math.PI) // Math.PI (wraps around)
|
|
83
|
+
* NormalizeRadians(-Math.PI) // Math.PI (negative angles normalized)
|
|
84
|
+
* NormalizeRadians(0) // 0
|
|
85
|
+
* ```
|
|
78
86
|
*/
|
|
79
87
|
export function NormalizeRadians(radians) {
|
|
80
88
|
const twoPi = 2 * Math.PI;
|
|
@@ -92,10 +100,12 @@ export function NormalizeRadians(radians) {
|
|
|
92
100
|
* @returns Normalized angle in degrees in the range [0°, 360°)
|
|
93
101
|
*
|
|
94
102
|
* @example
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
* ```typescript
|
|
104
|
+
* NormalizeDegrees(450) // 90 (wraps around 360°)
|
|
105
|
+
* NormalizeDegrees(-90) // 270 (negative angles normalized)
|
|
106
|
+
* NormalizeDegrees(0) // 0
|
|
107
|
+
* NormalizeDegrees(360 - 1e-11) // 0 (boundary epsilon snap)
|
|
108
|
+
* ```
|
|
99
109
|
*/
|
|
100
110
|
export function NormalizeDegrees(degrees) {
|
|
101
111
|
const result = ((degrees % DEGREES_PER_FULL_REVOLUTION) + DEGREES_PER_FULL_REVOLUTION) % DEGREES_PER_FULL_REVOLUTION;
|
package/build/angles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angles.js","sourceRoot":"","sources":["../src/angles.ts"],"names":[],"mappings":"AAAA,MAAM,2BAA2B,GAAG,GAAG,CAAC;AACxC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AACxC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AACxC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,iBAAiB,GAAG,KAAK,CAAC,CAAC,8CAA8C;AAE/E
|
|
1
|
+
{"version":3,"file":"angles.js","sourceRoot":"","sources":["../src/angles.ts"],"names":[],"mappings":"AAAA,MAAM,2BAA2B,GAAG,GAAG,CAAC;AACxC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AACxC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AACxC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,iBAAiB,GAAG,KAAK,CAAC,CAAC,8CAA8C;AAE/E;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC/C,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,2BAA2B,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC/C,OAAO,CAAC,OAAO,GAAG,2BAA2B,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC5C,MAAM,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;IAE5B,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,GAAG,CAAC;IACxB,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,GAAG,CAAC;IACxB,IAAI,CAAC,KAAK,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAE1B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACzB,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAE9B,iEAAiE;IACjE,0EAA0E;IAC1E,wEAAwE;IACxE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,qBAAqB,EAAE,CAAC,EAAE,EAAE,CAAC;QACjD,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAC/B,IAAI,CAAC,KAAK,CAAC;YAAE,SAAS,CAAQ,uBAAuB;QACrD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,SAAS,CAAI,mDAAmD;QACjF,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,wBAAwB,EAAE,CAAC;YACvD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACxD,CAAC;IACF,CAAC;IAED,OAAO,GAAG,CAAC,GAAG,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC/C,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;IAC1B,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;IACnD,6DAA6D;IAC7D,IAAI,MAAM,GAAG,iBAAiB,IAAI,MAAM,GAAG,KAAK,GAAG,iBAAiB;QAAE,OAAO,CAAC,CAAC;IAC/E,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC/C,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,GAAG,2BAA2B,CAAC,GAAG,2BAA2B,CAAC,GAAG,2BAA2B,CAAC;IACrH,wFAAwF;IACxF,IAAI,MAAM,GAAG,iBAAiB,IAAI,MAAM,GAAG,2BAA2B,GAAG,iBAAiB;QAAE,OAAO,CAAC,CAAC;IACrG,OAAO,MAAM,CAAC;AACf,CAAC"}
|
package/build/clamp.d.ts
CHANGED
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
* @returns The clamped value in the range [min, max]
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
|
+
* ```typescript
|
|
12
13
|
* Clamp(5, 0, 10) // 5 (within range)
|
|
13
14
|
* Clamp(-3, 0, 10) // 0 (below min)
|
|
14
15
|
* Clamp(15, 0, 10) // 10 (above max)
|
|
16
|
+
* ```
|
|
15
17
|
*/
|
|
16
18
|
export declare function Clamp(x: number, min: number, max: number): number;
|
|
17
19
|
//# sourceMappingURL=clamp.d.ts.map
|
package/build/clamp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clamp.d.ts","sourceRoot":"","sources":["../src/clamp.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"clamp.d.ts","sourceRoot":"","sources":["../src/clamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjE"}
|
package/build/clamp.js
CHANGED
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
* @returns The clamped value in the range [min, max]
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
|
+
* ```typescript
|
|
12
13
|
* Clamp(5, 0, 10) // 5 (within range)
|
|
13
14
|
* Clamp(-3, 0, 10) // 0 (below min)
|
|
14
15
|
* Clamp(15, 0, 10) // 10 (above max)
|
|
16
|
+
* ```
|
|
15
17
|
*/
|
|
16
18
|
export function Clamp(x, min, max) {
|
|
17
19
|
return Math.max(min, Math.min(x, max));
|
package/build/clamp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clamp.js","sourceRoot":"","sources":["../src/clamp.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"clamp.js","sourceRoot":"","sources":["../src/clamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,KAAK,CAAC,CAAS,EAAE,GAAW,EAAE,GAAW;IACxD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
package/build/core.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core mathematical utilities for pure numeric calculations.
|
|
3
|
+
* Provides foundational math operations with no domain coupling.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Calculates the cube root of a number, preserving the sign of the input.
|
|
7
|
+
* Handles negative numbers correctly (unlike Math.cbrt in some contexts).
|
|
8
|
+
*
|
|
9
|
+
* @param value - The value to calculate the cube root of
|
|
10
|
+
* @returns The cube root of the value, with same sign as input
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { CubeRoot } from '@pawells/math-extended';
|
|
15
|
+
*
|
|
16
|
+
* CubeRoot(8); // 2
|
|
17
|
+
* CubeRoot(-8); // -2
|
|
18
|
+
* CubeRoot(27); // 3
|
|
19
|
+
* CubeRoot(0); // 0
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function CubeRoot(value: number): number;
|
|
23
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9C"}
|
package/build/core.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core mathematical utilities for pure numeric calculations.
|
|
3
|
+
* Provides foundational math operations with no domain coupling.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Calculates the cube root of a number, preserving the sign of the input.
|
|
7
|
+
* Handles negative numbers correctly (unlike Math.cbrt in some contexts).
|
|
8
|
+
*
|
|
9
|
+
* @param value - The value to calculate the cube root of
|
|
10
|
+
* @returns The cube root of the value, with same sign as input
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { CubeRoot } from '@pawells/math-extended';
|
|
15
|
+
*
|
|
16
|
+
* CubeRoot(8); // 2
|
|
17
|
+
* CubeRoot(-8); // -2
|
|
18
|
+
* CubeRoot(27); // 3
|
|
19
|
+
* CubeRoot(0); // 0
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function CubeRoot(value) {
|
|
23
|
+
return Math.sign(value) * Math.pow(Math.abs(value), 1 / 3);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAa;IACrC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
export * as VectorUtils from './vectors/index.js';
|
|
2
|
-
export * as MatrixUtils from './matrices/index.js';
|
|
3
|
-
export * as QuaternionUtils from './quaternions/index.js';
|
|
4
|
-
export * from './angles.js';
|
|
5
1
|
export * from './clamp.js';
|
|
2
|
+
export * from './core.js';
|
|
6
3
|
export * from './interpolation.js';
|
|
7
4
|
export * from './matrices/index.js';
|
|
8
5
|
export * from './quaternions/index.js';
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
// Namespace exports for grouped imports
|
|
2
|
-
export * as VectorUtils from './vectors/index.js';
|
|
3
|
-
export * as MatrixUtils from './matrices/index.js';
|
|
4
|
-
export * as QuaternionUtils from './quaternions/index.js';
|
|
5
|
-
// Direct named exports for tree-shaking
|
|
6
|
-
export * from './angles.js';
|
|
7
1
|
export * from './clamp.js';
|
|
2
|
+
export * from './core.js';
|
|
8
3
|
export * from './interpolation.js';
|
|
9
4
|
export * from './matrices/index.js';
|
|
10
5
|
export * from './quaternions/index.js';
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|