@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.
Files changed (113) hide show
  1. package/README.md +15 -21
  2. package/build/angles.d.ts +28 -18
  3. package/build/angles.d.ts.map +1 -1
  4. package/build/angles.js +28 -18
  5. package/build/angles.js.map +1 -1
  6. package/build/clamp.d.ts +2 -0
  7. package/build/clamp.d.ts.map +1 -1
  8. package/build/clamp.js +2 -0
  9. package/build/clamp.js.map +1 -1
  10. package/build/core.d.ts +23 -0
  11. package/build/core.d.ts.map +1 -0
  12. package/build/core.js +25 -0
  13. package/build/core.js.map +1 -0
  14. package/build/index.d.ts +1 -4
  15. package/build/index.d.ts.map +1 -1
  16. package/build/index.js +1 -6
  17. package/build/index.js.map +1 -1
  18. package/build/interpolation.d.ts +62 -13
  19. package/build/interpolation.d.ts.map +1 -1
  20. package/build/interpolation.js +66 -23
  21. package/build/interpolation.js.map +1 -1
  22. package/build/matrices/arithmetic.d.ts +65 -76
  23. package/build/matrices/arithmetic.d.ts.map +1 -1
  24. package/build/matrices/arithmetic.js +65 -107
  25. package/build/matrices/arithmetic.js.map +1 -1
  26. package/build/matrices/asserts.d.ts +26 -273
  27. package/build/matrices/asserts.d.ts.map +1 -1
  28. package/build/matrices/asserts.js +106 -350
  29. package/build/matrices/asserts.js.map +1 -1
  30. package/build/matrices/core.d.ts +150 -79
  31. package/build/matrices/core.d.ts.map +1 -1
  32. package/build/matrices/core.js +128 -104
  33. package/build/matrices/core.js.map +1 -1
  34. package/build/matrices/decompositions.d.ts +41 -44
  35. package/build/matrices/decompositions.d.ts.map +1 -1
  36. package/build/matrices/decompositions.js +51 -94
  37. package/build/matrices/decompositions.js.map +1 -1
  38. package/build/matrices/index.d.ts +2 -2
  39. package/build/matrices/index.d.ts.map +1 -1
  40. package/build/matrices/index.js +2 -2
  41. package/build/matrices/index.js.map +1 -1
  42. package/build/matrices/linear-algebra.d.ts +56 -19
  43. package/build/matrices/linear-algebra.d.ts.map +1 -1
  44. package/build/matrices/linear-algebra.js +80 -36
  45. package/build/matrices/linear-algebra.js.map +1 -1
  46. package/build/matrices/normalization.d.ts +36 -15
  47. package/build/matrices/normalization.d.ts.map +1 -1
  48. package/build/matrices/normalization.js +32 -23
  49. package/build/matrices/normalization.js.map +1 -1
  50. package/build/matrices/transformations.d.ts +39 -52
  51. package/build/matrices/transformations.d.ts.map +1 -1
  52. package/build/matrices/transformations.js +8 -11
  53. package/build/matrices/transformations.js.map +1 -1
  54. package/build/matrices/types.d.ts +39 -67
  55. package/build/matrices/types.d.ts.map +1 -1
  56. package/build/matrices/types.js +63 -1
  57. package/build/matrices/types.js.map +1 -1
  58. package/build/quaternions/asserts.d.ts +114 -15
  59. package/build/quaternions/asserts.d.ts.map +1 -1
  60. package/build/quaternions/asserts.js +189 -51
  61. package/build/quaternions/asserts.js.map +1 -1
  62. package/build/quaternions/conversions.d.ts +18 -8
  63. package/build/quaternions/conversions.d.ts.map +1 -1
  64. package/build/quaternions/conversions.js +14 -4
  65. package/build/quaternions/conversions.js.map +1 -1
  66. package/build/quaternions/core.d.ts +31 -2
  67. package/build/quaternions/core.d.ts.map +1 -1
  68. package/build/quaternions/core.js +32 -4
  69. package/build/quaternions/core.js.map +1 -1
  70. package/build/quaternions/index.d.ts +2 -2
  71. package/build/quaternions/index.d.ts.map +1 -1
  72. package/build/quaternions/index.js +3 -2
  73. package/build/quaternions/index.js.map +1 -1
  74. package/build/quaternions/interpolation.d.ts +7 -1
  75. package/build/quaternions/interpolation.d.ts.map +1 -1
  76. package/build/quaternions/interpolation.js +12 -6
  77. package/build/quaternions/interpolation.js.map +1 -1
  78. package/build/quaternions/predefined.d.ts +7 -1
  79. package/build/quaternions/predefined.d.ts.map +1 -1
  80. package/build/quaternions/predefined.js +6 -0
  81. package/build/quaternions/predefined.js.map +1 -1
  82. package/build/quaternions/types.d.ts +24 -13
  83. package/build/quaternions/types.d.ts.map +1 -1
  84. package/build/quaternions/types.js +51 -1
  85. package/build/quaternions/types.js.map +1 -1
  86. package/build/random.d.ts +66 -20
  87. package/build/random.d.ts.map +1 -1
  88. package/build/random.js +73 -20
  89. package/build/random.js.map +1 -1
  90. package/build/vectors/asserts.d.ts +33 -99
  91. package/build/vectors/asserts.d.ts.map +1 -1
  92. package/build/vectors/asserts.js +145 -181
  93. package/build/vectors/asserts.js.map +1 -1
  94. package/build/vectors/core.d.ts +76 -44
  95. package/build/vectors/core.d.ts.map +1 -1
  96. package/build/vectors/core.js +128 -119
  97. package/build/vectors/core.js.map +1 -1
  98. package/build/vectors/index.d.ts.map +1 -1
  99. package/build/vectors/index.js +1 -0
  100. package/build/vectors/index.js.map +1 -1
  101. package/build/vectors/interpolation.d.ts +13 -1
  102. package/build/vectors/interpolation.d.ts.map +1 -1
  103. package/build/vectors/interpolation.js +48 -47
  104. package/build/vectors/interpolation.js.map +1 -1
  105. package/build/vectors/predefined.d.ts +73 -25
  106. package/build/vectors/predefined.d.ts.map +1 -1
  107. package/build/vectors/predefined.js +62 -18
  108. package/build/vectors/predefined.js.map +1 -1
  109. package/build/vectors/types.d.ts +26 -4
  110. package/build/vectors/types.d.ts.map +1 -1
  111. package/build/vectors/types.js +50 -1
  112. package/build/vectors/types.js.map +1 -1
  113. 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, or grouped via namespace imports for convenience.
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
- | **Namespace** | Grouping related functions | `import { VectorUtils } from '@pawells/math-extended'` |
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` | Shortest-arc scalar SLERP |
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`, `AssertVectorValue`, `AssertVectors`, `VectorError`
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 (`IMatrix`, `IMatrix1`–`IMatrix4`). All operations return new matrices.
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`, `AssertMatrixRow`, `AssertMatrixValue`, `AssertMatrices`, `MatrixError`
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 (1080 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
- MIT See [LICENSE](./LICENSE) for details.
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
- * DegreesToRadians(180) // Math.PI
8
- * DegreesToRadians(90) // Math.PI / 2
9
- * DegreesToRadians(0) // 0
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
- * RadiansToDegrees(Math.PI) // 180
19
- * RadiansToDegrees(Math.PI / 2) // 90
20
- * RadiansToDegrees(0) // 0
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
- * FormatRadians(0) // '0'
30
- * FormatRadians(Math.PI) // 'π'
31
- * FormatRadians(Math.PI / 2) // 'π/2'
32
- * FormatRadians(Math.PI / 4) // 'π/4'
33
- * FormatRadians(-Math.PI) // ''
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
- * NormalizeRadians(3 * Math.PI) // Math.PI (wraps around)
43
- * NormalizeRadians(-Math.PI) // Math.PI (negative angles normalized)
44
- * NormalizeRadians(0) // 0
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
- * NormalizeDegrees(450) // 90 (wraps around 360°)
56
- * NormalizeDegrees(-90) // 270 (negative angles normalized)
57
- * NormalizeDegrees(0) // 0
58
- * NormalizeDegrees(360 - 1e-11) // 0 (boundary epsilon snap)
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
@@ -1 +1 @@
1
- {"version":3,"file":"angles.d.ts","sourceRoot":"","sources":["../src/angles.ts"],"names":[],"mappings":"AAMA;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAuBrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMxD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKxD"}
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
- * DegreesToRadians(180) // Math.PI
13
- * DegreesToRadians(90) // Math.PI / 2
14
- * DegreesToRadians(0) // 0
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
- * RadiansToDegrees(Math.PI) // 180
26
- * RadiansToDegrees(Math.PI / 2) // 90
27
- * RadiansToDegrees(0) // 0
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
- * FormatRadians(0) // '0'
39
- * FormatRadians(Math.PI) // 'π'
40
- * FormatRadians(Math.PI / 2) // 'π/2'
41
- * FormatRadians(Math.PI / 4) // 'π/4'
42
- * FormatRadians(-Math.PI) // ''
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
- * NormalizeRadians(3 * Math.PI) // Math.PI (wraps around)
76
- * NormalizeRadians(-Math.PI) // Math.PI (negative angles normalized)
77
- * NormalizeRadians(0) // 0
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
- * NormalizeDegrees(450) // 90 (wraps around 360°)
96
- * NormalizeDegrees(-90) // 270 (negative angles normalized)
97
- * NormalizeDegrees(0) // 0
98
- * NormalizeDegrees(360 - 1e-11) // 0 (boundary epsilon snap)
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;
@@ -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;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC/C,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,2BAA2B,CAAC;AAC1D,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC/C,OAAO,CAAC,OAAO,GAAG,2BAA2B,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;;GAWG;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;IAC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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
@@ -1 +1 @@
1
- {"version":3,"file":"clamp.d.ts","sourceRoot":"","sources":["../src/clamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjE"}
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));
@@ -1 +1 @@
1
- {"version":3,"file":"clamp.js","sourceRoot":"","sources":["../src/clamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;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"}
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"}
@@ -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';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,WAAW,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAG1D,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
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';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,WAAW,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAE1D,wCAAwC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
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"}