@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
|
@@ -16,8 +16,10 @@ export function VectorOne(size) {
|
|
|
16
16
|
* @returns [0, 1] - Unit vector in positive Y direction
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const upDirection = Vector2_Up(); // Character movement upward
|
|
21
|
+
* const velocity = Vector2_Up().map(c => c * speed); // Moving up at given speed
|
|
22
|
+
* ```
|
|
21
23
|
*/
|
|
22
24
|
export function Vector2Up() {
|
|
23
25
|
return [0, 1];
|
|
@@ -29,8 +31,10 @@ export function Vector2Up() {
|
|
|
29
31
|
* @returns [0, 1, 0] - Unit vector in positive Y direction
|
|
30
32
|
*
|
|
31
33
|
* @example
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const worldUp = Vector3_Up(); // World space up direction
|
|
36
|
+
* const jumpForce = Vector3_Up().map(c => c * jumpStrength);
|
|
37
|
+
* ```
|
|
34
38
|
*/
|
|
35
39
|
export function Vector3Up() {
|
|
36
40
|
return [0, 1, 0];
|
|
@@ -51,8 +55,10 @@ export function Vector4Up() {
|
|
|
51
55
|
* @returns [0, -1] - Unit vector in negative Y direction
|
|
52
56
|
*
|
|
53
57
|
* @example
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const gravity = Vector2_Down().map(c => c * 9.81); // Gravity force
|
|
60
|
+
* const dropDirection = Vector2_Down(); // Object falling down
|
|
61
|
+
* ```
|
|
56
62
|
*/
|
|
57
63
|
export function Vector2Down() {
|
|
58
64
|
return [0, -1];
|
|
@@ -64,8 +70,10 @@ export function Vector2Down() {
|
|
|
64
70
|
* @returns [0, -1, 0] - Unit vector in negative Y direction
|
|
65
71
|
*
|
|
66
72
|
* @example
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const gravityForce = Vector3Down().map(c => c * 9.81);
|
|
75
|
+
* const downwardRay = Vector3Down(); // Raycast downward
|
|
76
|
+
* ```
|
|
69
77
|
*/
|
|
70
78
|
export function Vector3Down() {
|
|
71
79
|
return [0, -1, 0];
|
|
@@ -85,8 +93,10 @@ export function Vector4Down() {
|
|
|
85
93
|
* @returns [-1, 0] - Unit vector in negative X direction
|
|
86
94
|
*
|
|
87
95
|
* @example
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const leftMovement = Vector2Left().map(c => c * speed);
|
|
98
|
+
* const leftDirection = Vector2Left(); // Character facing left
|
|
99
|
+
* ```
|
|
90
100
|
*/
|
|
91
101
|
export function Vector2Left() {
|
|
92
102
|
return [-1, 0];
|
|
@@ -98,7 +108,9 @@ export function Vector2Left() {
|
|
|
98
108
|
* @returns [-1, 0, 0] - Unit vector in negative X direction
|
|
99
109
|
*
|
|
100
110
|
* @example
|
|
101
|
-
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const strafeLeft = Vector3Left().map(c => c * strafeSpeed);
|
|
113
|
+
* ```
|
|
102
114
|
*/
|
|
103
115
|
export function Vector3Left() {
|
|
104
116
|
return [-1, 0, 0];
|
|
@@ -118,8 +130,10 @@ export function Vector4Left() {
|
|
|
118
130
|
* @returns [1, 0] - Unit vector in positive X direction
|
|
119
131
|
*
|
|
120
132
|
* @example
|
|
121
|
-
|
|
122
|
-
|
|
133
|
+
* ```typescript
|
|
134
|
+
* const rightMovement = Vector2Right().map(c => c * speed);
|
|
135
|
+
* const rightDirection = Vector2Right(); // Character facing right
|
|
136
|
+
* ```
|
|
123
137
|
*/
|
|
124
138
|
export function Vector2Right() {
|
|
125
139
|
return [1, 0];
|
|
@@ -131,7 +145,9 @@ export function Vector2Right() {
|
|
|
131
145
|
* @returns [1, 0, 0] - Unit vector in positive X direction
|
|
132
146
|
*
|
|
133
147
|
* @example
|
|
134
|
-
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const strafeRight = Vector3Right().map(c => c * strafeSpeed);
|
|
150
|
+
* ```
|
|
135
151
|
*/
|
|
136
152
|
export function Vector3Right() {
|
|
137
153
|
return [1, 0, 0];
|
|
@@ -152,8 +168,10 @@ export function Vector4Right() {
|
|
|
152
168
|
* @returns [0, 0, 1] - Unit vector in positive Z direction
|
|
153
169
|
*
|
|
154
170
|
* @example
|
|
155
|
-
|
|
156
|
-
|
|
171
|
+
* ```typescript
|
|
172
|
+
* const forwardMovement = Vector3Forward().map(c => c * speed);
|
|
173
|
+
* const cameraForward = Vector3Forward(); // Camera looking direction
|
|
174
|
+
* ```
|
|
157
175
|
*/
|
|
158
176
|
export function Vector3Forward() {
|
|
159
177
|
return [0, 0, 1];
|
|
@@ -174,8 +192,10 @@ export function Vector4Forward() {
|
|
|
174
192
|
* @returns [0, 0, -1] - Unit vector in negative Z direction
|
|
175
193
|
*
|
|
176
194
|
* @example
|
|
177
|
-
|
|
178
|
-
|
|
195
|
+
* ```typescript
|
|
196
|
+
* const backwardMovement = Vector3Backward().map(c => c * speed);
|
|
197
|
+
* const reverseDirection = Vector3Backward(); // Moving away from target
|
|
198
|
+
* ```
|
|
179
199
|
*/
|
|
180
200
|
export function Vector3Backward() {
|
|
181
201
|
return [0, 0, -1];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predefined.js","sourceRoot":"","sources":["../../src/vectors/predefined.ts"],"names":[],"mappings":"AA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;IAC1B,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW;IAC1B,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACtB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY;IAC3B,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACf,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY;IAC3B,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAC3B,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACrB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc;IAC7B,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC7B,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACrB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe;IAC9B,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC9B,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACtB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pawells/math-extended",
|
|
3
3
|
"displayName": "Math Extended",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"description": "Shared TypeScript math library — vectors, matrices, quaternions, interpolation, angles, and random utilities. ESM-only.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./build/index.js",
|
|
@@ -23,27 +23,28 @@
|
|
|
23
23
|
"test": "vitest run",
|
|
24
24
|
"test:ui": "vitest --ui",
|
|
25
25
|
"test:coverage": "vitest --coverage",
|
|
26
|
+
"pipeline": "yarn lint && yarn typecheck && yarn test && yarn build",
|
|
26
27
|
"prepublishOnly": "npm run build",
|
|
27
28
|
"prepare": "husky"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"@pawells/typescript-common": "
|
|
31
|
+
"@pawells/typescript-common": "2.0.0"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@eslint/js": "^10.0.1",
|
|
34
|
-
"@stylistic/eslint-plugin": "^5.
|
|
35
|
-
"@types/node": "^25.3.
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
37
|
-
"@typescript-eslint/parser": "^8.
|
|
35
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
36
|
+
"@types/node": "^25.3.2",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
|
38
|
+
"@typescript-eslint/parser": "^8.56.1",
|
|
38
39
|
"@vitest/coverage-v8": "^4.0.18",
|
|
39
40
|
"@vitest/ui": "^4.0.18",
|
|
40
|
-
"eslint": "^10.0.
|
|
41
|
+
"eslint": "^10.0.3",
|
|
41
42
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
42
43
|
"eslint-plugin-import": "^2.31.0",
|
|
43
44
|
"eslint-plugin-unused-imports": "^4.0.0",
|
|
44
|
-
"globals": "^17.
|
|
45
|
+
"globals": "^17.4.0",
|
|
45
46
|
"husky": "^9.1.7",
|
|
46
|
-
"typescript": "^
|
|
47
|
+
"typescript": "^6.0.2",
|
|
47
48
|
"vitest": "^4.0.18"
|
|
48
49
|
},
|
|
49
50
|
"keywords": [
|
|
@@ -68,15 +69,11 @@
|
|
|
68
69
|
},
|
|
69
70
|
"homepage": "https://github.com/PhillipAWells/math-extended#readme",
|
|
70
71
|
"engines": {
|
|
71
|
-
"node": ">=
|
|
72
|
+
"node": ">=22.0.0"
|
|
72
73
|
},
|
|
73
74
|
"packageManager": "yarn@4.12.0",
|
|
74
75
|
"files": [
|
|
75
|
-
"build
|
|
76
|
-
"build/**/*.d.ts",
|
|
77
|
-
"build/**/*.js.map",
|
|
78
|
-
"build/**/*.d.ts.map",
|
|
79
|
-
"!build/**/*.test.*",
|
|
76
|
+
"build/",
|
|
80
77
|
"README.md",
|
|
81
78
|
"LICENSE",
|
|
82
79
|
".env.example"
|