@pawells/math-extended 1.1.1 → 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/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 +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 +158 -96
- package/build/interpolation.d.ts.map +1 -1
- package/build/interpolation.js +158 -96
- 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 +240 -109
- package/build/matrices/asserts.d.ts.map +1 -1
- package/build/matrices/asserts.js +287 -87
- package/build/matrices/asserts.js.map +1 -1
- package/build/matrices/core.d.ts +29 -29
- package/build/matrices/core.js +1 -1
- package/build/matrices/decompositions.d.ts +102 -104
- package/build/matrices/decompositions.d.ts.map +1 -1
- package/build/matrices/decompositions.js +87 -89
- 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 +12 -12
- package/build/matrices/linear-algebra.js +4 -4
- package/build/matrices/normalization.d.ts +8 -8
- package/build/matrices/transformations.d.ts +184 -165
- package/build/matrices/transformations.d.ts.map +1 -1
- package/build/matrices/transformations.js +99 -80
- 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 +67 -39
- package/build/quaternions/core.d.ts.map +1 -1
- package/build/quaternions/core.js +67 -39
- 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/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 +212 -149
- 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 +3 -3
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;IA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I,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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
* ```typescript
|
|
13
|
+
* Clamp(5, 0, 10) // 5 (within range)
|
|
14
|
+
* Clamp(-3, 0, 10) // 0 (below min)
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
* ```typescript
|
|
13
|
+
* Clamp(5, 0, 10) // 5 (within range)
|
|
14
|
+
* Clamp(-3, 0, 10) // 0 (below min)
|
|
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"}
|