mathue 0.1.0 → 0.1.1
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/LICENSE +9 -9
- package/README.md +114 -88
- package/dist/index.d.ts +57 -39
- package/dist/mathue.cjs +1 -1
- package/dist/mathue.js +30 -20
- package/dist/mathue.umd.cjs +1 -1
- package/package.json +62 -56
package/LICENSE
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
The MIT License
|
|
2
|
-
|
|
3
|
-
Copyright 2025 SueueGunn
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright 2025 SueueGunn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,88 +1,114 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="typedoc/favicon.ico" width="200">
|
|
3
|
-
</p>
|
|
4
|
-
<h1 align="center">mathue</h1>
|
|
5
|
-
|
|
6
|
-
[](https://github.com/sueuegunn/mathue/actions/workflows/test.yaml)
|
|
7
|
-
](https://opensource.org/licenses/MIT)
|
|
9
|
-
](https://github.com/sueuegunn/mathue/actions/workflows/test.yaml)
|
|
7
|
+

|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](https://www.npmjs.com/package/mathue)
|
|
10
|
+
|
|
11
|
+
**A high-performance TypeScript math library specially optimized for WebGL applications.**
|
|
12
|
+
|
|
13
|
+
Pronounced as **"Matthew"** ( mˈæθjuː ).
|
|
14
|
+
|
|
15
|
+
<br>
|
|
16
|
+
|
|
17
|
+
## 🔗 Links
|
|
18
|
+
|
|
19
|
+
* [Docs](https://sueuegunn.github.io/mathue/index.html)
|
|
20
|
+
* [npm](https://www.npmjs.com/package/mathue)
|
|
21
|
+
|
|
22
|
+
<br>
|
|
23
|
+
|
|
24
|
+
## 🚀 Why mathue?
|
|
25
|
+
|
|
26
|
+
Standard math libraries often create new objects for every calculation, causing Garbage Collection (GC) spikes that ruin the performance of real-time rendering loops (60fps+).
|
|
27
|
+
|
|
28
|
+
**mathue is designed to be "Zero-Allocation" by default.**
|
|
29
|
+
|
|
30
|
+
<br>
|
|
31
|
+
|
|
32
|
+
### Key Features
|
|
33
|
+
|
|
34
|
+
* **⚡ Zero-Allocation Design**: Minimizes GC overhead by using **mutable operations** (in-place modification) and reusing **static internal temporaries** for complex calculations.
|
|
35
|
+
* **🛠️ Flexible**: While optimized for mutation, every class implements `.clone()` and factory methods (e.g., `.identity()`, `.zero()`) for when you need immutable behavior.
|
|
36
|
+
* **⛓️ Method Chaining**: All mutable methods return `this`, allowing for concise and readable code similar to modern engines.
|
|
37
|
+
* **ts TypeScript First**: Built completely in TypeScript with full type definitions (`.d.ts`) included.
|
|
38
|
+
* **🟢 Standalone**: No external dependencies.
|
|
39
|
+
|
|
40
|
+
<br>
|
|
41
|
+
|
|
42
|
+
## 📦 Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install mathue
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
<br>
|
|
49
|
+
|
|
50
|
+
## 📖 Usage
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
// Applies matrix to vector
|
|
54
|
+
import {Vector3, Matrix4, Quaternion} from 'mathue';
|
|
55
|
+
|
|
56
|
+
const v = new Vector3(1, 2, 3);
|
|
57
|
+
|
|
58
|
+
const axis = new Vector3(0, 0, 1);
|
|
59
|
+
const angle = Math.PI / 3;
|
|
60
|
+
const q = Quaternion.fromAxisAndAngle(axis, angle);
|
|
61
|
+
|
|
62
|
+
const m = Matrix4.identity();
|
|
63
|
+
m.setQuaternion(q);
|
|
64
|
+
|
|
65
|
+
v.applyMatrix4(m);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
// Calculates model matrix
|
|
70
|
+
const position = new Vector3(1, 2, 3);
|
|
71
|
+
const rotation = Quaternion.identity();
|
|
72
|
+
const scale = new Vector3(2, 2, 2);
|
|
73
|
+
|
|
74
|
+
const model = Matrix4.identity();
|
|
75
|
+
|
|
76
|
+
model.setIdentity()
|
|
77
|
+
.multiplyTranslation(position)
|
|
78
|
+
.multiplyRotation(rotation)
|
|
79
|
+
.multiplyScale(scale);
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
<br>
|
|
83
|
+
|
|
84
|
+
## 📚 API Overview
|
|
85
|
+
|
|
86
|
+
* Vector
|
|
87
|
+
* Vector1
|
|
88
|
+
* Vector2
|
|
89
|
+
* Vector3
|
|
90
|
+
* Vector4
|
|
91
|
+
* Matrix (Column-major order, WebGL compatible)
|
|
92
|
+
* Matrix3
|
|
93
|
+
* Matrix4
|
|
94
|
+
* PolarCoordinate3
|
|
95
|
+
* Quaternion (For rotation without gimbal lock)
|
|
96
|
+
|
|
97
|
+
See the [Full Documentation](https://sueuegunn.github.io/mathue/index.html) for details.
|
|
98
|
+
|
|
99
|
+
<br>
|
|
100
|
+
|
|
101
|
+
## 📄 License
|
|
102
|
+
|
|
103
|
+
MIT License
|
|
104
|
+
|
|
105
|
+
<br>
|
|
106
|
+
|
|
107
|
+
## 📐 Logo
|
|
108
|
+
|
|
109
|
+
<p align="center">
|
|
110
|
+
<img src="typedoc/favicon.ico" width="128">
|
|
111
|
+
</p>
|
|
112
|
+
|
|
113
|
+
The logo features **two upward vectors** arranged to form the letter "M".
|
|
114
|
+
Conceptually, the right vector represents the left vector transformed by a Matrix or Quaternion.
|
package/dist/index.d.ts
CHANGED
|
@@ -458,16 +458,52 @@ export declare class Matrix4 implements Matrix<4>, AdditiveGroup<Matrix4>, Parti
|
|
|
458
458
|
* ```
|
|
459
459
|
*/
|
|
460
460
|
setIdentity(): Matrix4;
|
|
461
|
+
/**
|
|
462
|
+
* Sets scale transformation matrix (mutates this)
|
|
463
|
+
* @param scale 3D scale vector
|
|
464
|
+
* @returns this instance, for method chaining
|
|
465
|
+
*
|
|
466
|
+
* @example
|
|
467
|
+
* ```ts
|
|
468
|
+
* const m = Matrix4.identity();
|
|
469
|
+
* const s = new Vector3(2, 3, 4);
|
|
470
|
+
* m.setScale(s);
|
|
471
|
+
* console.log(m.elements);
|
|
472
|
+
* // [ 2, 0, 0, 0,
|
|
473
|
+
* // 0, 3, 0, 0,
|
|
474
|
+
* // 0, 0, 4, 0,
|
|
475
|
+
* // 0, 0, 0, 1 ]
|
|
476
|
+
* ```
|
|
477
|
+
*/
|
|
478
|
+
setScale(scale: Vector3): Matrix4;
|
|
479
|
+
/**
|
|
480
|
+
* Sets translation transformation matrix (mutates this)
|
|
481
|
+
* @param translation translation vector
|
|
482
|
+
* @returns this instance, for method chaining
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* ```ts
|
|
486
|
+
* const m = Matrix4.identity();
|
|
487
|
+
* const t = new Vector3(2, 3, 4);
|
|
488
|
+
* m.setTranslation(t);
|
|
489
|
+
* console.log(m.elements);
|
|
490
|
+
* // [ 1, 0, 0, 0,
|
|
491
|
+
* // 0, 1, 0, 0,
|
|
492
|
+
* // 0, 0, 1, 0,
|
|
493
|
+
* // 2, 3, 4, 1 ]
|
|
494
|
+
* ```
|
|
495
|
+
*/
|
|
496
|
+
setTranslation(translation: Vector3): Matrix4;
|
|
461
497
|
/**
|
|
462
498
|
* Sets rotation matrix from quaternion (mutates this)
|
|
463
|
-
* @param
|
|
499
|
+
* @param rotation
|
|
464
500
|
* @returns this instance, for method chaining
|
|
465
501
|
*
|
|
466
502
|
* @example
|
|
467
503
|
* ```ts
|
|
468
504
|
* const m = Matrix4.zero();
|
|
469
505
|
* const q = Quaternion.identity();
|
|
470
|
-
* m.
|
|
506
|
+
* m.setRotation(q);
|
|
471
507
|
* console.log(m.elements);
|
|
472
508
|
* // [ 0, 0, 0, 0,
|
|
473
509
|
* // 0, 0, 0, 0,
|
|
@@ -475,7 +511,7 @@ export declare class Matrix4 implements Matrix<4>, AdditiveGroup<Matrix4>, Parti
|
|
|
475
511
|
* // 0, 0, 0, 0 ]
|
|
476
512
|
* ```
|
|
477
513
|
*/
|
|
478
|
-
|
|
514
|
+
setRotation(rotation: Quaternion): Matrix4;
|
|
479
515
|
/**
|
|
480
516
|
* Adds by other matrix (mutates this)
|
|
481
517
|
* @param other other matrix
|
|
@@ -564,6 +600,24 @@ export declare class Matrix4 implements Matrix<4>, AdditiveGroup<Matrix4>, Parti
|
|
|
564
600
|
* ```
|
|
565
601
|
*/
|
|
566
602
|
multiply(other: Matrix4): Matrix4;
|
|
603
|
+
/**
|
|
604
|
+
* Multiplies scale matrix to this instance (mutates this)
|
|
605
|
+
* @param scale 3D scale vector
|
|
606
|
+
* @returns this instance, for method chaining
|
|
607
|
+
*/
|
|
608
|
+
multiplyScale(scale: Vector3): Matrix4;
|
|
609
|
+
/**
|
|
610
|
+
* Multiplies translation matrix to this instance (mutates this)
|
|
611
|
+
* @param position translation vector
|
|
612
|
+
* @returns this instance, for method chaining
|
|
613
|
+
*/
|
|
614
|
+
multiplyTranslation(position: Vector3): Matrix4;
|
|
615
|
+
/**
|
|
616
|
+
* Multiplies rotation matrix to this instance (mutates this)
|
|
617
|
+
* @param rotation rotation quaternion
|
|
618
|
+
* @returns this instance, for method chaining
|
|
619
|
+
*/
|
|
620
|
+
multiplyRotation(rotation: Quaternion): Matrix4;
|
|
567
621
|
/**
|
|
568
622
|
* Calculates determinant of this matrix (pure)
|
|
569
623
|
* @returns determinant of this matrix
|
|
@@ -585,42 +639,6 @@ export declare class Matrix4 implements Matrix<4>, AdditiveGroup<Matrix4>, Parti
|
|
|
585
639
|
* @returns `this` instance for method chaining if other is invertible, `null` otherwise
|
|
586
640
|
*/
|
|
587
641
|
divide(other: Matrix4): Matrix4 | null;
|
|
588
|
-
/**
|
|
589
|
-
* Sets scale transformation matrix (mutates this)
|
|
590
|
-
* @param scale 3D scale vector
|
|
591
|
-
* @returns this instance, for method chaining
|
|
592
|
-
*
|
|
593
|
-
* @example
|
|
594
|
-
* ```ts
|
|
595
|
-
* const m = Matrix4.identity();
|
|
596
|
-
* const s = new Vector3(2, 3, 4);
|
|
597
|
-
* m.scale(s);
|
|
598
|
-
* console.log(m.elements);
|
|
599
|
-
* // [ 2, 0, 0, 0,
|
|
600
|
-
* // 0, 3, 0, 0,
|
|
601
|
-
* // 0, 0, 4, 0,
|
|
602
|
-
* // 0, 0, 0, 1 ]
|
|
603
|
-
* ```
|
|
604
|
-
*/
|
|
605
|
-
scale(scale: Vector3): Matrix4;
|
|
606
|
-
/**
|
|
607
|
-
* Sets translation transformation matrix (mutates this)
|
|
608
|
-
* @param translation translation vector
|
|
609
|
-
* @returns this instance, for method chaining
|
|
610
|
-
*
|
|
611
|
-
* @example
|
|
612
|
-
* ```ts
|
|
613
|
-
* const m = Matrix4.identity();
|
|
614
|
-
* const t = new Vector3(2, 3, 4);
|
|
615
|
-
* m.translate(t);
|
|
616
|
-
* console.log(m.elements);
|
|
617
|
-
* // [ 1, 0, 0, 0,
|
|
618
|
-
* // 0, 1, 0, 0,
|
|
619
|
-
* // 0, 0, 1, 0,
|
|
620
|
-
* // 2, 3, 4, 1 ]
|
|
621
|
-
* ```
|
|
622
|
-
*/
|
|
623
|
-
translate(translation: Vector3): Matrix4;
|
|
624
642
|
/**
|
|
625
643
|
* Sets view transformation matrix (mutates this)
|
|
626
644
|
* @param position camera position
|
package/dist/mathue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function*e(e,t){let n=t?.start??0,r=t?.step??1;if(r!==0&&!(r>0&&n>e)&&!(r<0&&n<e))for(let t=n;r>0?t<e:t>e;t+=r)yield t}function t(e){let t=0;for(let n of e)t+=n;return t}function n(e,t){let n=0;for(let r of e)n+=t(r)??0;return n}var r=0,i=1,a=2,o=3,s=class e{dimension=4;elements;static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=l.identity(),this._tmpMatrix4}constructor(e,t,n,r){this.elements=[e,t,n,r]}get x(){return this.elements[r]}set x(e){this.elements[r]=e}get y(){return this.elements[i]}set y(e){this.elements[i]=e}get z(){return this.elements[a]}set z(e){this.elements[a]=e}get w(){return this.elements[o]}set w(e){this.elements[o]=e}static zero(){return new e(0,0,0,0)}static one(){return new e(1,1,1,1)}clone(){let{x:t,y:n,z:r,w:i}=this;return new e(t,n,r,i)}isZero(){let{x:e,y:t,z:n,w:r}=this;return e===0&&t===0&&n===0&&r===0}set(e,t,n,r){this.x=e,this.y=t,this.z=n,this.w=r}copy(e){let{x:t,y:n,z:r,w:i}=e;this.set(t,n,r,i)}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}subtract(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}divideScalar(e){return this.x/=e,this.y/=e,this.z/=e,this.w/=e,this}length(){let{x:e,y:t,z:n,w:r}=this;return Math.sqrt(e**2+t**2+n**2+r**2)}normalize(){let e=this.length();return e<=0?this:this.divideScalar(e)}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r,y:i,z:a,w:o}=this,s=n._applyVector(r,i,a,o);return this.copy(s),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setQuaternion(t);let{x:r,y:i,z:a,w:o}=this,s=n._applyVector(r,i,a,o);return this.copy(s),this}},c=1e-8,l=class t{order=4;elements;static _tmpMatrix;static get tmpMatrix(){return this._tmpMatrix||=t.identity(),this._tmpMatrix}static _tmpVector;static get tmpVector(){return this._tmpVector||=s.zero(),this._tmpVector}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=Float32Array.of(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}static identity(){return t.zero().setIdentity()}static zero(){return new t(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}clone(){let[e,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]=this.elements;return new t(e,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){return this.elements[0]=e,this.elements[1]=t,this.elements[2]=n,this.elements[3]=r,this.elements[4]=i,this.elements[5]=a,this.elements[6]=o,this.elements[7]=s,this.elements[8]=c,this.elements[9]=l,this.elements[10]=u,this.elements[11]=d,this.elements[12]=f,this.elements[13]=p,this.elements[14]=m,this.elements[15]=h,this}copy(e){let[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]=e.elements;this.set(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}setIdentity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}setQuaternion(e){let{a:t,b:n,c:r,d:i}=e,a=2/e.squaredNorm(),o=n**2,s=r**2,c=i**2,l=t*n,u=t*r,d=t*i,f=n*r,p=n*i,m=r*i;return this.set(1-a*(s+c),a*(f-d),a*(p+u),0,a*(f+d),1-a*(o+c),a*(m-l),0,a*(p-u),a*(m+l),1-a*(o+s),0,0,0,0,1),this}add(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]+=t.elements[r];return this}subtract(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]-=t.elements[r];return this}multiplyScalar(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]*=t;return this}divideScalar(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]/=t;return this}multiply(e){let[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]=this.elements,[_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M]=e.elements;return this.elements[0]=_*t+v*a+y*l+b*p,this.elements[1]=_*n+v*o+y*u+b*m,this.elements[2]=_*r+v*s+y*d+b*h,this.elements[3]=_*i+v*c+y*f+b*g,this.elements[4]=x*t+S*a+C*l+w*p,this.elements[5]=x*n+S*o+C*u+w*m,this.elements[6]=x*r+S*s+C*d+w*h,this.elements[7]=x*i+S*c+C*f+w*g,this.elements[8]=T*t+E*a+D*l+O*p,this.elements[9]=T*n+E*o+D*u+O*m,this.elements[10]=T*r+E*s+D*d+O*h,this.elements[11]=T*i+E*c+D*f+O*g,this.elements[12]=k*t+A*a+j*l+M*p,this.elements[13]=k*n+A*o+j*u+M*m,this.elements[14]=k*r+A*s+j*d+M*h,this.elements[15]=k*i+A*c+j*f+M*g,this}determinant(){let[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]=this.elements;return e*(a*(u*h-d*m)-o*(l*h-d*p)+s*(l*m-u*p))-t*(i*(u*h-d*m)-o*(c*h-d*f)+s*(c*m-u*f))+n*(i*(l*h-d*p)-a*(c*h-d*f)+s*(c*p-l*f))-r*(i*(l*m-u*p)-a*(c*m-u*f)+o*(c*p-l*f))}invert(){let e=this.determinant();if(Math.abs(e)<c)return null;let[t,n,r,i,a,o,s,l,u,d,f,p,m,h,g,_]=this.elements,v=f*_-p*g,y=d*_-p*h,b=d*g-f*h,x=s*_-l*g,S=o*_-l*h,C=o*g-s*h,w=s*p-l*f,T=o*p-l*d,E=o*f-s*d,D=u*_-p*m,O=u*g-f*m,k=a*_-l*m,A=a*g-s*m,j=a*p-l*u,M=a*f-s*u,N=u*h-d*m,P=a*h-o*m,F=a*d-o*u;return this.elements[0]=(o*v-s*y+l*b)/e,this.elements[1]=-(n*v-r*y+i*b)/e,this.elements[2]=(n*x-r*S+i*C)/e,this.elements[3]=-(n*w-r*T+i*E)/e,this.elements[4]=-(a*v-s*D+l*O)/e,this.elements[5]=(t*v-r*D+i*O)/e,this.elements[6]=-(t*x-r*k+i*A)/e,this.elements[7]=(t*w-r*j+i*M)/e,this.elements[8]=(a*y-o*D+l*N)/e,this.elements[9]=-(t*y-n*D+i*N)/e,this.elements[10]=(t*S-n*k+i*P)/e,this.elements[11]=-(t*T-n*j+i*F)/e,this.elements[12]=-(a*b-o*O+s*N)/e,this.elements[13]=(t*b-n*O+r*N)/e,this.elements[14]=-(t*C-n*A+r*P)/e,this.elements[15]=(t*E-n*M+r*F)/e,this}transpose(){let[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]=this.elements;return this.elements[1]=i,this.elements[2]=c,this.elements[3]=f,this.elements[4]=t,this.elements[6]=l,this.elements[7]=p,this.elements[8]=n,this.elements[9]=o,this.elements[11]=m,this.elements[12]=r,this.elements[13]=s,this.elements[14]=d,this}divide(e){let{tmpMatrix:n}=t;return n.copy(e),n.invert()?this.multiply(n):null}scale(t){let{order:n}=this;for(let r of e(n)){let i=r===n-1?1:t.elements[r];for(let t of e(n)){let e=r*n+t;this.elements[e]*=i}}return this}translate(e){let{x:t,y:n,z:r}=e,[i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y]=this.elements;return this.elements[12]=i*t+c*n+f*r+g,this.elements[13]=a*t+l*n+p*r+_,this.elements[14]=o*t+u*n+m*r+v,this.elements[15]=s*t+d*n+h*r+y,this}lookAt(e,t,n){let{x:r,y:i,z:a}=e,{x:o,y:s,z:l}=n,u=e.x-t.x,d=e.y-t.y,f=e.z-t.z,p=Math.sqrt(u**2+d**2+f**2);if(p<c)return this;u/=p,d/=p,f/=p;let m=s*f-l*d,h=l*u-o*f,g=o*d-s*u,_=Math.sqrt(m**2+h**2+g**2);_>0&&(m/=_,h/=_,g/=_);let v=d*g-f*h,y=f*m-u*g,b=u*h-d*m,x=Math.sqrt(v**2+y**2+b**2);x>0&&(v/=x,y/=x,b/=x);let S=-(m*r+h*i+g*a),C=-(v*r+y*i+b*a),w=-(u*r+d*i+f*a);return this.set(m,v,u,0,h,y,d,0,g,b,f,0,S,C,w,1),this}perspective(e,t,n,r){let i=1/Math.tan(e/2);return this.set(i/r,0,0,0,0,i,0,0,0,0,1,-1,0,0,1,0),n===1/0?(this.elements[10]=-1,this.elements[14]=-2*t):(this.elements[10]=-(n+t)/(n-t),this.elements[14]=-2*n*t/(n-t)),this}_applyVector(e,n,r,i){let{tmpVector:a}=t;a.set(e,n,r,i);let[o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x]=this.elements,S=o*e+u*n+m*r+v*i,C=s*e+d*n+h*r+y*i,w=c*e+f*n+g*r+b*i,T=l*e+p*n+_*r+x*i;return a.set(S,C,w,T),a}},u=0,d=1,f=2,p=class e{dimension=3;elements;static _tmpMatrix3;static get tmpMatrix3(){return this._tmpMatrix3||=h.identity(),this._tmpMatrix3}static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=l.identity(),this._tmpMatrix4}constructor(e,t,n){this.elements=[e,t,n]}get x(){return this.elements[u]}set x(e){this.elements[u]=e}get y(){return this.elements[d]}set y(e){this.elements[d]=e}get z(){return this.elements[f]}set z(e){this.elements[f]=e}static zero(){return new e(0,0,0)}static one(){return new e(1,1,1)}clone(){let{x:t,y:n,z:r}=this;return new e(t,n,r)}isZero(){let{x:e,y:t,z:n}=this;return e===0&&t===0&&n===0}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}copy(e){let{x:t,y:n,z:r}=e;return this.set(t,n,r)}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}subtract(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}divideScalar(e){return this.x/=e,this.y/=e,this.z/=e,this}length(){let{x:e,y:t,z:n}=this;return Math.sqrt(e**2+t**2+n**2)}normalize(){let e=this.length();return e<=0?this:this.divideScalar(e)}cross(e){let{x:t,y:n,z:r}=this,{x:i,y:a,z:o}=e,s=n*o-r*a,c=r*i-t*o,l=t*a-n*i;return this.set(s,c,l)}crossTo(e,t){return t.copy(this),t.cross(e)}applyMatrix3(t){let{tmpMatrix3:n}=e;n.copy(t);let{x:r,y:i,z:a}=n._applyVector(this.x,this.y,this.z);return this.set(r,i,a),this}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r,y:i,z:a}=n._applyVector(this.x,this.y,this.z,0);return this.set(r,i,a),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setQuaternion(t);let{x:r,y:i,z:a}=n._applyVector(this.x,this.y,this.z,0);return this.set(r,i,a),this}},m=1e-8,h=class t{order=3;elements;static _tmpMatrix;static get tmpMatrix(){return this._tmpMatrix||=t.identity(),this._tmpMatrix}static _tmpVector;static get tmpVector(){return this._tmpVector||=p.zero(),this._tmpVector}constructor(e,t,n,r,i,a,o,s,c){this.elements=Float32Array.of(e,t,n,r,i,a,o,s,c)}static identity(){return t.zero().setIdentity()}static zero(){return new t(0,0,0,0,0,0,0,0,0)}clone(){let[e,n,r,i,a,o,s,c,l]=this.elements;return new t(e,n,r,i,a,o,s,c,l)}set(e,t,n,r,i,a,o,s,c){return this.elements[0]=e,this.elements[1]=t,this.elements[2]=n,this.elements[3]=r,this.elements[4]=i,this.elements[5]=a,this.elements[6]=o,this.elements[7]=s,this.elements[8]=c,this}copy(e){let[t,n,r,i,a,o,s,c,l]=e.elements;this.set(t,n,r,i,a,o,s,c,l)}setIdentity(){return this.set(1,0,0,0,1,0,0,0,1),this}add(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]+=t.elements[r];return this}subtract(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]-=t.elements[r];return this}multiplyScalar(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]*=t;return this}divideScalar(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]/=t;return this}multiply(e){let[t,n,r,i,a,o,s,c,l]=this.elements,[u,d,f,p,m,h,g,_,v]=e.elements;return this.elements[0]=u*t+d*i+f*s,this.elements[1]=u*n+d*a+f*c,this.elements[2]=u*r+d*o+f*l,this.elements[3]=p*t+m*i+h*s,this.elements[4]=p*n+m*a+h*c,this.elements[5]=p*r+m*o+h*l,this.elements[6]=g*t+_*i+v*s,this.elements[7]=g*n+_*a+v*c,this.elements[8]=g*r+_*o+v*l,this}determinant(){let[e,t,n,r,i,a,o,s,c]=this.elements;return e*(c*i-a*s)+t*(-c*r+a*o)+n*(s*r-i*o)}invert(){let e=this.determinant();if(Math.abs(e)<m)return null;let[t,n,r,i,a,o,s,c,l]=this.elements,u=l*a-o*c,d=-l*i+o*s,f=c*i-a*s;return this.elements[0]=u/e,this.elements[1]=(-l*n+r*c)/e,this.elements[2]=(o*n-r*a)/e,this.elements[3]=d/e,this.elements[4]=(l*t-r*s)/e,this.elements[5]=(-o*t+r*i)/e,this.elements[6]=f/e,this.elements[7]=(-c*t+n*s)/e,this.elements[8]=(a*t-n*i)/e,this}transpose(){let[e,t,n,r,i,a,o,s,c]=this.elements;return this.elements[1]=r,this.elements[2]=o,this.elements[3]=t,this.elements[5]=s,this.elements[6]=n,this.elements[7]=a,this}divide(e){let{tmpMatrix:n}=t;return n.copy(e),n.invert()?this.multiply(n):null}_applyVector(e,n,r){let{tmpVector:i}=t;i.set(e,n,r);let[a,o,s,c,l,u,d,f,p]=this.elements,m=a*e+c*n+d*r,h=o*e+l*n+f*r,g=s*e+u*n+p*r;return i.set(m,h,g),i}},g=class{_phi;_theta;_radius;constructor(e,t,n){this._phi=e,this._theta=t,this._radius=n}get phi(){return this._phi}set phi(e){this._phi=e}get theta(){return this._theta}set theta(e){this._theta=e}get radius(){return this._radius}set radius(e){this._radius=e}toVector3(e){let{phi:t,theta:n,radius:r}=this,{cos:i,sin:a}=Math,o=a(n),s=r*o*i(t),c=r*o*a(t),l=r*i(n);e.set(s,c,l)}toTangentZ(e){let{phi:t,theta:n}=this,{cos:r,sin:i}=Math,a=r(n),o=-a*r(t),s=-a*i(t),c=i(n);e.set(o,s,c)}},_=class e{_a;_b;_c;_d;static temporary=e.identity();constructor(e,t,n,r){this._a=e,this._b=t,this._c=n,this._d=r}get a(){return this._a}get b(){return this._b}get c(){return this._c}get d(){return this._d}static identity(){return new e(1,0,0,0)}static fromAxisAndAngle(t,n){let r=e.identity();return r.setAxisAndAngle(t,n),r}clone(){let{a:t,b:n,c:r,d:i}=this;return new e(t,n,r,i)}set(e,t,n,r){return this._a=e,this._b=t,this._c=n,this._d=r,this}copy(e){let{a:t,b:n,c:r,d:i}=e;return this.set(t,n,r,i)}setIdentity(){this.set(1,0,0,0)}setAxisAndAngle(e,t){if(e.isZero())return this.setIdentity();e.normalize();let{x:n,y:r,z:i}=e,a=Math.sin(t/2);this.set(Math.cos(t/2),n*a,r*a,i*a)}squaredNorm(){let{a:e,b:t,c:n,d:r}=this;return e**2+t**2+n**2+r**2}norm(){return Math.sqrt(this.squaredNorm())}conjugate(){return this._b*=-1,this._c*=-1,this._d*=-1,this}add(e){let{a:t,b:n,c:r,d:i}=e;return this._a+=t,this._b+=n,this._c+=r,this._d+=i,this}subtract(e){let{a:t,b:n,c:r,d:i}=e;return this._a-=t,this._b-=n,this._c-=r,this._d-=i,this}multiply(e){let{a:t,b:n,c:r,d:i}=this,{a,b:o,c:s,d:c}=e;return this._a=t*a-n*o-r*s-i*c,this._b=t*o+n*a+r*c-i*s,this._c=t*s-n*c+r*a+i*o,this._d=t*c+n*s-r*o+i*a,this}invert(){let e=this.squaredNorm();return e<=0?null:this.conjugate().divideScalar(e)}divide(t){let{temporary:n}=e;return n.copy(t),n.invert()?this.multiply(n):null}multiplyScalar(e){return this._a*=e,this._b*=e,this._c*=e,this._d*=e,this}divideScalar(e){return this._a/=e,this._b/=e,this._c/=e,this._d/=e,this}rotateX(t){let{temporary:n}=e;return n.setIdentity(),n.setAxisAndAngle(new p(1,0,0),t),this.multiply(n)}rotateY(t){let{temporary:n}=e;return n.setIdentity(),n.setAxisAndAngle(new p(0,1,0),t),this.multiply(n)}rotateZ(t){let{temporary:n}=e;return n.setIdentity(),n.setAxisAndAngle(new p(0,0,1),t),this.multiply(n)}},v=0,y=class e{dimension=1;elements;static _tmpMatrix3;static get tmpMatrix3(){return this._tmpMatrix3||=h.identity(),this._tmpMatrix3}static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=l.identity(),this._tmpMatrix4}constructor(e){this.elements=[e]}get x(){return this.elements[v]}set x(e){this.elements[v]=e}static zero(){return new e(0)}static one(){return new e(1)}clone(){let{x:t}=this;return new e(t)}isZero(){return this.x===0}set(e){return this.x=e,this}copy(e){return this.x=e.x,this}add(e){return this.x+=e.x,this}subtract(e){return this.x-=e.x,this}multiplyScalar(e){return this.x*=e,this}divideScalar(e){return this.x/=e,this}length(){return Math.abs(this.x)}normalize(){return this.x/=this.length(),this}applyMatrix3(t){let{tmpMatrix3:n}=e;n.copy(t);let{x:r}=n._applyVector(this.x,0,0);return this.set(r),this}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r}=n._applyVector(this.x,0,0,0);return this.set(r),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setQuaternion(t);let{x:r}=n._applyVector(this.x,0,0,0);return this.set(r),this}},b=0,x=1,S=class e{dimension=2;elements;static _tmpMatrix3;static get tmpMatrix3(){return this._tmpMatrix3||=h.identity(),this._tmpMatrix3}static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=l.identity(),this._tmpMatrix4}constructor(e,t){this.elements=[e,t]}get x(){return this.elements[b]}set x(e){this.elements[b]=e}get y(){return this.elements[x]}set y(e){this.elements[x]=e}static zero(){return new e(0,0)}static one(){return new e(1,1)}clone(){let{x:t,y:n}=this;return new e(t,n)}isZero(){let{x:e,y:t}=this;return e===0&&t===0}set(e,t){return this.x=e,this.y=t,this}copy(e){let{x:t,y:n}=e;return this.set(t,n)}add(e){return this.x+=e.x,this.y+=e.y,this}subtract(e){return this.x-=e.x,this.y-=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divideScalar(e){return this.x/=e,this.y/=e,this}length(){let{x:e,y:t}=this;return Math.sqrt(e**2+t**2)}normalize(){let e=this.length();return e<=0?this:this.divideScalar(e)}rotate(e){let{cos:t,sin:n}=Math,r=this.x*t(e)-this.y*n(e),i=this.x*n(e)+this.y*t(e);return this.x=r,this.y=i,this}applyMatrix3(t){let{tmpMatrix3:n}=e;n.copy(t);let{x:r,y:i}=n._applyVector(this.x,this.y,0);return this.set(r,i),this}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r,y:i}=n._applyVector(this.x,this.y,0,0);return this.set(r,i),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setQuaternion(t);let{x:r,y:i}=n._applyVector(this.x,this.y,0,0);return this.set(r,i),this}};exports.Matrix3=h,exports.Matrix4=l,exports.PolarCoordinate3=g,exports.Quaternion=_,exports.Vector1=y,exports.Vector2=S,exports.Vector3=p,exports.Vector4=s,exports.range=e,exports.sum=t,exports.sumMap=n;
|
|
1
|
+
function*e(e,t){let n=t?.start??0,r=t?.step??1;if(r!==0&&!(r>0&&n>e)&&!(r<0&&n<e))for(let t=n;r>0?t<e:t>e;t+=r)yield t}function t(e){let t=0;for(let n of e)t+=n;return t}function n(e,t){let n=0;for(let r of e)n+=t(r)??0;return n}var r=0,i=1,a=2,o=3,s=class e{dimension=4;elements;static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=l.identity(),this._tmpMatrix4}constructor(e,t,n,r){this.elements=[e,t,n,r]}get x(){return this.elements[r]}set x(e){this.elements[r]=e}get y(){return this.elements[i]}set y(e){this.elements[i]=e}get z(){return this.elements[a]}set z(e){this.elements[a]=e}get w(){return this.elements[o]}set w(e){this.elements[o]=e}static zero(){return new e(0,0,0,0)}static one(){return new e(1,1,1,1)}clone(){let{x:t,y:n,z:r,w:i}=this;return new e(t,n,r,i)}isZero(){let{x:e,y:t,z:n,w:r}=this;return e===0&&t===0&&n===0&&r===0}set(e,t,n,r){this.x=e,this.y=t,this.z=n,this.w=r}copy(e){let{x:t,y:n,z:r,w:i}=e;this.set(t,n,r,i)}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}subtract(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}divideScalar(e){return this.x/=e,this.y/=e,this.z/=e,this.w/=e,this}length(){let{x:e,y:t,z:n,w:r}=this;return Math.sqrt(e**2+t**2+n**2+r**2)}normalize(){let e=this.length();return e<=0?this:this.divideScalar(e)}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r,y:i,z:a,w:o}=this,s=n._applyVector(r,i,a,o);return this.copy(s),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setRotation(t);let{x:r,y:i,z:a,w:o}=this,s=n._applyVector(r,i,a,o);return this.copy(s),this}},c=1e-8,l=class t{order=4;elements;static _tmpMatrix;static get tmpMatrix(){return this._tmpMatrix||=t.identity(),this._tmpMatrix}static _tmpVector;static get tmpVector(){return this._tmpVector||=s.zero(),this._tmpVector}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=Float32Array.of(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}static identity(){return t.zero().setIdentity()}static zero(){return new t(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}clone(){let[e,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]=this.elements;return new t(e,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){return this.elements[0]=e,this.elements[1]=t,this.elements[2]=n,this.elements[3]=r,this.elements[4]=i,this.elements[5]=a,this.elements[6]=o,this.elements[7]=s,this.elements[8]=c,this.elements[9]=l,this.elements[10]=u,this.elements[11]=d,this.elements[12]=f,this.elements[13]=p,this.elements[14]=m,this.elements[15]=h,this}copy(e){let[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]=e.elements;this.set(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}setIdentity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}setScale(t){this.setIdentity();let{order:n}=this;for(let r of e(n)){let i=r===n-1?1:t.elements[r];for(let t of e(n)){let e=r*n+t;this.elements[e]*=i}}return this}setTranslation(e){let{x:t,y:n,z:r}=e,[i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y]=this.elements;return this.setIdentity(),this.elements[12]=i*t+c*n+f*r+g,this.elements[13]=a*t+l*n+p*r+_,this.elements[14]=o*t+u*n+m*r+v,this.elements[15]=s*t+d*n+h*r+y,this}setRotation(e){let{a:t,b:n,c:r,d:i}=e,a=2/e.squaredNorm(),o=n**2,s=r**2,c=i**2,l=t*n,u=t*r,d=t*i,f=n*r,p=n*i,m=r*i;return this.set(1-a*(s+c),a*(f-d),a*(p+u),0,a*(f+d),1-a*(o+c),a*(m-l),0,a*(p-u),a*(m+l),1-a*(o+s),0,0,0,0,1),this}add(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]+=t.elements[r];return this}subtract(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]-=t.elements[r];return this}multiplyScalar(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]*=t;return this}divideScalar(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]/=t;return this}multiply(e){let[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]=this.elements,[_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M]=e.elements;return this.elements[0]=_*t+v*a+y*l+b*p,this.elements[1]=_*n+v*o+y*u+b*m,this.elements[2]=_*r+v*s+y*d+b*h,this.elements[3]=_*i+v*c+y*f+b*g,this.elements[4]=x*t+S*a+C*l+w*p,this.elements[5]=x*n+S*o+C*u+w*m,this.elements[6]=x*r+S*s+C*d+w*h,this.elements[7]=x*i+S*c+C*f+w*g,this.elements[8]=T*t+E*a+D*l+O*p,this.elements[9]=T*n+E*o+D*u+O*m,this.elements[10]=T*r+E*s+D*d+O*h,this.elements[11]=T*i+E*c+D*f+O*g,this.elements[12]=k*t+A*a+j*l+M*p,this.elements[13]=k*n+A*o+j*u+M*m,this.elements[14]=k*r+A*s+j*d+M*h,this.elements[15]=k*i+A*c+j*f+M*g,this}multiplyScale(e){return this.multiply(t.tmpMatrix.setScale(e))}multiplyTranslation(e){return this.multiply(t.tmpMatrix.setTranslation(e))}multiplyRotation(e){return this.multiply(t.tmpMatrix.setRotation(e))}determinant(){let[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]=this.elements;return e*(a*(u*h-d*m)-o*(l*h-d*p)+s*(l*m-u*p))-t*(i*(u*h-d*m)-o*(c*h-d*f)+s*(c*m-u*f))+n*(i*(l*h-d*p)-a*(c*h-d*f)+s*(c*p-l*f))-r*(i*(l*m-u*p)-a*(c*m-u*f)+o*(c*p-l*f))}invert(){let e=this.determinant();if(Math.abs(e)<c)return null;let[t,n,r,i,a,o,s,l,u,d,f,p,m,h,g,_]=this.elements,v=f*_-p*g,y=d*_-p*h,b=d*g-f*h,x=s*_-l*g,S=o*_-l*h,C=o*g-s*h,w=s*p-l*f,T=o*p-l*d,E=o*f-s*d,D=u*_-p*m,O=u*g-f*m,k=a*_-l*m,A=a*g-s*m,j=a*p-l*u,M=a*f-s*u,N=u*h-d*m,P=a*h-o*m,F=a*d-o*u;return this.elements[0]=(o*v-s*y+l*b)/e,this.elements[1]=-(n*v-r*y+i*b)/e,this.elements[2]=(n*x-r*S+i*C)/e,this.elements[3]=-(n*w-r*T+i*E)/e,this.elements[4]=-(a*v-s*D+l*O)/e,this.elements[5]=(t*v-r*D+i*O)/e,this.elements[6]=-(t*x-r*k+i*A)/e,this.elements[7]=(t*w-r*j+i*M)/e,this.elements[8]=(a*y-o*D+l*N)/e,this.elements[9]=-(t*y-n*D+i*N)/e,this.elements[10]=(t*S-n*k+i*P)/e,this.elements[11]=-(t*T-n*j+i*F)/e,this.elements[12]=-(a*b-o*O+s*N)/e,this.elements[13]=(t*b-n*O+r*N)/e,this.elements[14]=-(t*C-n*A+r*P)/e,this.elements[15]=(t*E-n*M+r*F)/e,this}transpose(){let[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]=this.elements;return this.elements[1]=i,this.elements[2]=c,this.elements[3]=f,this.elements[4]=t,this.elements[6]=l,this.elements[7]=p,this.elements[8]=n,this.elements[9]=o,this.elements[11]=m,this.elements[12]=r,this.elements[13]=s,this.elements[14]=d,this}divide(e){let{tmpMatrix:n}=t;return n.copy(e),n.invert()?this.multiply(n):null}lookAt(e,t,n){let{x:r,y:i,z:a}=e,{x:o,y:s,z:l}=n,u=e.x-t.x,d=e.y-t.y,f=e.z-t.z,p=Math.sqrt(u**2+d**2+f**2);if(p<c)return this;u/=p,d/=p,f/=p;let m=s*f-l*d,h=l*u-o*f,g=o*d-s*u,_=Math.sqrt(m**2+h**2+g**2);_>0&&(m/=_,h/=_,g/=_);let v=d*g-f*h,y=f*m-u*g,b=u*h-d*m,x=Math.sqrt(v**2+y**2+b**2);x>0&&(v/=x,y/=x,b/=x);let S=-(m*r+h*i+g*a),C=-(v*r+y*i+b*a),w=-(u*r+d*i+f*a);return this.set(m,v,u,0,h,y,d,0,g,b,f,0,S,C,w,1),this}perspective(e,t,n,r){let i=1/Math.tan(e/2);return this.set(i/r,0,0,0,0,i,0,0,0,0,1,-1,0,0,1,0),n===1/0?(this.elements[10]=-1,this.elements[14]=-2*t):(this.elements[10]=-(n+t)/(n-t),this.elements[14]=-2*n*t/(n-t)),this}_applyVector(e,n,r,i){let{tmpVector:a}=t;a.set(e,n,r,i);let[o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x]=this.elements,S=o*e+u*n+m*r+v*i,C=s*e+d*n+h*r+y*i,w=c*e+f*n+g*r+b*i,T=l*e+p*n+_*r+x*i;return a.set(S,C,w,T),a}},u=0,d=1,f=2,p=class e{dimension=3;elements;static _tmpMatrix3;static get tmpMatrix3(){return this._tmpMatrix3||=h.identity(),this._tmpMatrix3}static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=l.identity(),this._tmpMatrix4}constructor(e,t,n){this.elements=[e,t,n]}get x(){return this.elements[u]}set x(e){this.elements[u]=e}get y(){return this.elements[d]}set y(e){this.elements[d]=e}get z(){return this.elements[f]}set z(e){this.elements[f]=e}static zero(){return new e(0,0,0)}static one(){return new e(1,1,1)}clone(){let{x:t,y:n,z:r}=this;return new e(t,n,r)}isZero(){let{x:e,y:t,z:n}=this;return e===0&&t===0&&n===0}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}copy(e){let{x:t,y:n,z:r}=e;return this.set(t,n,r)}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}subtract(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}divideScalar(e){return this.x/=e,this.y/=e,this.z/=e,this}length(){let{x:e,y:t,z:n}=this;return Math.sqrt(e**2+t**2+n**2)}normalize(){let e=this.length();return e<=0?this:this.divideScalar(e)}cross(e){let{x:t,y:n,z:r}=this,{x:i,y:a,z:o}=e,s=n*o-r*a,c=r*i-t*o,l=t*a-n*i;return this.set(s,c,l)}crossTo(e,t){return t.copy(this),t.cross(e)}applyMatrix3(t){let{tmpMatrix3:n}=e;n.copy(t);let{x:r,y:i,z:a}=n._applyVector(this.x,this.y,this.z);return this.set(r,i,a),this}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r,y:i,z:a}=n._applyVector(this.x,this.y,this.z,0);return this.set(r,i,a),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setRotation(t);let{x:r,y:i,z:a}=n._applyVector(this.x,this.y,this.z,0);return this.set(r,i,a),this}},m=1e-8,h=class t{order=3;elements;static _tmpMatrix;static get tmpMatrix(){return this._tmpMatrix||=t.identity(),this._tmpMatrix}static _tmpVector;static get tmpVector(){return this._tmpVector||=p.zero(),this._tmpVector}constructor(e,t,n,r,i,a,o,s,c){this.elements=Float32Array.of(e,t,n,r,i,a,o,s,c)}static identity(){return t.zero().setIdentity()}static zero(){return new t(0,0,0,0,0,0,0,0,0)}clone(){let[e,n,r,i,a,o,s,c,l]=this.elements;return new t(e,n,r,i,a,o,s,c,l)}set(e,t,n,r,i,a,o,s,c){return this.elements[0]=e,this.elements[1]=t,this.elements[2]=n,this.elements[3]=r,this.elements[4]=i,this.elements[5]=a,this.elements[6]=o,this.elements[7]=s,this.elements[8]=c,this}copy(e){let[t,n,r,i,a,o,s,c,l]=e.elements;this.set(t,n,r,i,a,o,s,c,l)}setIdentity(){return this.set(1,0,0,0,1,0,0,0,1),this}add(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]+=t.elements[r];return this}subtract(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]-=t.elements[r];return this}multiplyScalar(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]*=t;return this}divideScalar(t){let{order:n}=this;for(let r of e(n**2))this.elements[r]/=t;return this}multiply(e){let[t,n,r,i,a,o,s,c,l]=this.elements,[u,d,f,p,m,h,g,_,v]=e.elements;return this.elements[0]=u*t+d*i+f*s,this.elements[1]=u*n+d*a+f*c,this.elements[2]=u*r+d*o+f*l,this.elements[3]=p*t+m*i+h*s,this.elements[4]=p*n+m*a+h*c,this.elements[5]=p*r+m*o+h*l,this.elements[6]=g*t+_*i+v*s,this.elements[7]=g*n+_*a+v*c,this.elements[8]=g*r+_*o+v*l,this}determinant(){let[e,t,n,r,i,a,o,s,c]=this.elements;return e*(c*i-a*s)+t*(-c*r+a*o)+n*(s*r-i*o)}invert(){let e=this.determinant();if(Math.abs(e)<m)return null;let[t,n,r,i,a,o,s,c,l]=this.elements,u=l*a-o*c,d=-l*i+o*s,f=c*i-a*s;return this.elements[0]=u/e,this.elements[1]=(-l*n+r*c)/e,this.elements[2]=(o*n-r*a)/e,this.elements[3]=d/e,this.elements[4]=(l*t-r*s)/e,this.elements[5]=(-o*t+r*i)/e,this.elements[6]=f/e,this.elements[7]=(-c*t+n*s)/e,this.elements[8]=(a*t-n*i)/e,this}transpose(){let[e,t,n,r,i,a,o,s,c]=this.elements;return this.elements[1]=r,this.elements[2]=o,this.elements[3]=t,this.elements[5]=s,this.elements[6]=n,this.elements[7]=a,this}divide(e){let{tmpMatrix:n}=t;return n.copy(e),n.invert()?this.multiply(n):null}_applyVector(e,n,r){let{tmpVector:i}=t;i.set(e,n,r);let[a,o,s,c,l,u,d,f,p]=this.elements,m=a*e+c*n+d*r,h=o*e+l*n+f*r,g=s*e+u*n+p*r;return i.set(m,h,g),i}},g=class{_phi;_theta;_radius;constructor(e,t,n){this._phi=e,this._theta=t,this._radius=n}get phi(){return this._phi}set phi(e){this._phi=e}get theta(){return this._theta}set theta(e){this._theta=e}get radius(){return this._radius}set radius(e){this._radius=e}toVector3(e){let{phi:t,theta:n,radius:r}=this,{cos:i,sin:a}=Math,o=a(n),s=r*o*i(t),c=r*o*a(t),l=r*i(n);e.set(s,c,l)}toTangentZ(e){let{phi:t,theta:n}=this,{cos:r,sin:i}=Math,a=r(n),o=-a*r(t),s=-a*i(t),c=i(n);e.set(o,s,c)}},_=class e{_a;_b;_c;_d;static temporary=e.identity();constructor(e,t,n,r){this._a=e,this._b=t,this._c=n,this._d=r}get a(){return this._a}get b(){return this._b}get c(){return this._c}get d(){return this._d}static identity(){return new e(1,0,0,0)}static fromAxisAndAngle(t,n){let r=e.identity();return r.setAxisAndAngle(t,n),r}clone(){let{a:t,b:n,c:r,d:i}=this;return new e(t,n,r,i)}set(e,t,n,r){return this._a=e,this._b=t,this._c=n,this._d=r,this}copy(e){let{a:t,b:n,c:r,d:i}=e;return this.set(t,n,r,i)}setIdentity(){this.set(1,0,0,0)}setAxisAndAngle(e,t){if(e.isZero())return this.setIdentity();e.normalize();let{x:n,y:r,z:i}=e,a=Math.sin(t/2);this.set(Math.cos(t/2),n*a,r*a,i*a)}squaredNorm(){let{a:e,b:t,c:n,d:r}=this;return e**2+t**2+n**2+r**2}norm(){return Math.sqrt(this.squaredNorm())}conjugate(){return this._b*=-1,this._c*=-1,this._d*=-1,this}add(e){let{a:t,b:n,c:r,d:i}=e;return this._a+=t,this._b+=n,this._c+=r,this._d+=i,this}subtract(e){let{a:t,b:n,c:r,d:i}=e;return this._a-=t,this._b-=n,this._c-=r,this._d-=i,this}multiply(e){let{a:t,b:n,c:r,d:i}=this,{a,b:o,c:s,d:c}=e;return this._a=t*a-n*o-r*s-i*c,this._b=t*o+n*a+r*c-i*s,this._c=t*s-n*c+r*a+i*o,this._d=t*c+n*s-r*o+i*a,this}invert(){let e=this.squaredNorm();return e<=0?null:this.conjugate().divideScalar(e)}divide(t){let{temporary:n}=e;return n.copy(t),n.invert()?this.multiply(n):null}multiplyScalar(e){return this._a*=e,this._b*=e,this._c*=e,this._d*=e,this}divideScalar(e){return this._a/=e,this._b/=e,this._c/=e,this._d/=e,this}rotateX(t){let{temporary:n}=e;return n.setIdentity(),n.setAxisAndAngle(new p(1,0,0),t),this.multiply(n)}rotateY(t){let{temporary:n}=e;return n.setIdentity(),n.setAxisAndAngle(new p(0,1,0),t),this.multiply(n)}rotateZ(t){let{temporary:n}=e;return n.setIdentity(),n.setAxisAndAngle(new p(0,0,1),t),this.multiply(n)}},v=0,y=class e{dimension=1;elements;static _tmpMatrix3;static get tmpMatrix3(){return this._tmpMatrix3||=h.identity(),this._tmpMatrix3}static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=l.identity(),this._tmpMatrix4}constructor(e){this.elements=[e]}get x(){return this.elements[v]}set x(e){this.elements[v]=e}static zero(){return new e(0)}static one(){return new e(1)}clone(){let{x:t}=this;return new e(t)}isZero(){return this.x===0}set(e){return this.x=e,this}copy(e){return this.x=e.x,this}add(e){return this.x+=e.x,this}subtract(e){return this.x-=e.x,this}multiplyScalar(e){return this.x*=e,this}divideScalar(e){return this.x/=e,this}length(){return Math.abs(this.x)}normalize(){return this.x/=this.length(),this}applyMatrix3(t){let{tmpMatrix3:n}=e;n.copy(t);let{x:r}=n._applyVector(this.x,0,0);return this.set(r),this}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r}=n._applyVector(this.x,0,0,0);return this.set(r),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setRotation(t);let{x:r}=n._applyVector(this.x,0,0,0);return this.set(r),this}},b=0,x=1,S=class e{dimension=2;elements;static _tmpMatrix3;static get tmpMatrix3(){return this._tmpMatrix3||=h.identity(),this._tmpMatrix3}static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=l.identity(),this._tmpMatrix4}constructor(e,t){this.elements=[e,t]}get x(){return this.elements[b]}set x(e){this.elements[b]=e}get y(){return this.elements[x]}set y(e){this.elements[x]=e}static zero(){return new e(0,0)}static one(){return new e(1,1)}clone(){let{x:t,y:n}=this;return new e(t,n)}isZero(){let{x:e,y:t}=this;return e===0&&t===0}set(e,t){return this.x=e,this.y=t,this}copy(e){let{x:t,y:n}=e;return this.set(t,n)}add(e){return this.x+=e.x,this.y+=e.y,this}subtract(e){return this.x-=e.x,this.y-=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divideScalar(e){return this.x/=e,this.y/=e,this}length(){let{x:e,y:t}=this;return Math.sqrt(e**2+t**2)}normalize(){let e=this.length();return e<=0?this:this.divideScalar(e)}rotate(e){let{cos:t,sin:n}=Math,r=this.x*t(e)-this.y*n(e),i=this.x*n(e)+this.y*t(e);return this.x=r,this.y=i,this}applyMatrix3(t){let{tmpMatrix3:n}=e;n.copy(t);let{x:r,y:i}=n._applyVector(this.x,this.y,0);return this.set(r,i),this}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r,y:i}=n._applyVector(this.x,this.y,0,0);return this.set(r,i),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setRotation(t);let{x:r,y:i}=n._applyVector(this.x,this.y,0,0);return this.set(r,i),this}};exports.Matrix3=h,exports.Matrix4=l,exports.PolarCoordinate3=g,exports.Quaternion=_,exports.Vector1=y,exports.Vector2=S,exports.Vector3=p,exports.Vector4=s,exports.range=e,exports.sum=t,exports.sumMap=n;
|
package/dist/mathue.js
CHANGED
|
@@ -100,7 +100,7 @@ var INDEX_X$3 = 0, INDEX_Y$2 = 1, INDEX_Z$1 = 2, INDEX_W = 3, Vector4 = class e
|
|
|
100
100
|
}
|
|
101
101
|
applyQuaternion(t) {
|
|
102
102
|
let { tmpMatrix4: n } = e;
|
|
103
|
-
n.
|
|
103
|
+
n.setRotation(t);
|
|
104
104
|
let { x: r, y: i, z: a, w: o } = this, s = n._applyVector(r, i, a, o);
|
|
105
105
|
return this.copy(s), this;
|
|
106
106
|
}
|
|
@@ -138,7 +138,23 @@ var INDEX_X$3 = 0, INDEX_Y$2 = 1, INDEX_Z$1 = 2, INDEX_W = 3, Vector4 = class e
|
|
|
138
138
|
setIdentity() {
|
|
139
139
|
return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this;
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
setScale(t) {
|
|
142
|
+
this.setIdentity();
|
|
143
|
+
let { order: n } = this;
|
|
144
|
+
for (let r of range(n)) {
|
|
145
|
+
let i = r === n - 1 ? 1 : t.elements[r];
|
|
146
|
+
for (let t of range(n)) {
|
|
147
|
+
let e = r * n + t;
|
|
148
|
+
this.elements[e] *= i;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
setTranslation(e) {
|
|
154
|
+
let { x: t, y: n, z: r } = e, [i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y] = this.elements;
|
|
155
|
+
return this.setIdentity(), this.elements[12] = i * t + c * n + f * r + g, this.elements[13] = a * t + l * n + p * r + _, this.elements[14] = o * t + u * n + m * r + v, this.elements[15] = s * t + d * n + h * r + y, this;
|
|
156
|
+
}
|
|
157
|
+
setRotation(e) {
|
|
142
158
|
let { a: t, b: n, c: r, d: i } = e, a = 2 / e.squaredNorm(), o = n ** 2, s = r ** 2, c = i ** 2, l = t * n, u = t * r, d = t * i, f = n * r, p = n * i, m = r * i;
|
|
143
159
|
return this.set(1 - a * (s + c), a * (f - d), a * (p + u), 0, a * (f + d), 1 - a * (o + c), a * (m - l), 0, a * (p - u), a * (m + l), 1 - a * (o + s), 0, 0, 0, 0, 1), this;
|
|
144
160
|
}
|
|
@@ -166,6 +182,15 @@ var INDEX_X$3 = 0, INDEX_Y$2 = 1, INDEX_Z$1 = 2, INDEX_W = 3, Vector4 = class e
|
|
|
166
182
|
let [t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g] = this.elements, [_, v, y, b, x, S, C, w, T, E, D, O, k, A, j, M] = e.elements;
|
|
167
183
|
return this.elements[0] = _ * t + v * a + y * l + b * p, this.elements[1] = _ * n + v * o + y * u + b * m, this.elements[2] = _ * r + v * s + y * d + b * h, this.elements[3] = _ * i + v * c + y * f + b * g, this.elements[4] = x * t + S * a + C * l + w * p, this.elements[5] = x * n + S * o + C * u + w * m, this.elements[6] = x * r + S * s + C * d + w * h, this.elements[7] = x * i + S * c + C * f + w * g, this.elements[8] = T * t + E * a + D * l + O * p, this.elements[9] = T * n + E * o + D * u + O * m, this.elements[10] = T * r + E * s + D * d + O * h, this.elements[11] = T * i + E * c + D * f + O * g, this.elements[12] = k * t + A * a + j * l + M * p, this.elements[13] = k * n + A * o + j * u + M * m, this.elements[14] = k * r + A * s + j * d + M * h, this.elements[15] = k * i + A * c + j * f + M * g, this;
|
|
168
184
|
}
|
|
185
|
+
multiplyScale(e) {
|
|
186
|
+
return this.multiply(t.tmpMatrix.setScale(e));
|
|
187
|
+
}
|
|
188
|
+
multiplyTranslation(e) {
|
|
189
|
+
return this.multiply(t.tmpMatrix.setTranslation(e));
|
|
190
|
+
}
|
|
191
|
+
multiplyRotation(e) {
|
|
192
|
+
return this.multiply(t.tmpMatrix.setRotation(e));
|
|
193
|
+
}
|
|
169
194
|
determinant() {
|
|
170
195
|
let [e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h] = this.elements;
|
|
171
196
|
return e * (a * (u * h - d * m) - o * (l * h - d * p) + s * (l * m - u * p)) - t * (i * (u * h - d * m) - o * (c * h - d * f) + s * (c * m - u * f)) + n * (i * (l * h - d * p) - a * (c * h - d * f) + s * (c * p - l * f)) - r * (i * (l * m - u * p) - a * (c * m - u * f) + o * (c * p - l * f));
|
|
@@ -184,21 +209,6 @@ var INDEX_X$3 = 0, INDEX_Y$2 = 1, INDEX_Z$1 = 2, INDEX_W = 3, Vector4 = class e
|
|
|
184
209
|
let { tmpMatrix: n } = t;
|
|
185
210
|
return n.copy(e), n.invert() ? this.multiply(n) : null;
|
|
186
211
|
}
|
|
187
|
-
scale(t) {
|
|
188
|
-
let { order: n } = this;
|
|
189
|
-
for (let r of range(n)) {
|
|
190
|
-
let i = r === n - 1 ? 1 : t.elements[r];
|
|
191
|
-
for (let t of range(n)) {
|
|
192
|
-
let e = r * n + t;
|
|
193
|
-
this.elements[e] *= i;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return this;
|
|
197
|
-
}
|
|
198
|
-
translate(e) {
|
|
199
|
-
let { x: t, y: n, z: r } = e, [i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y] = this.elements;
|
|
200
|
-
return this.elements[12] = i * t + c * n + f * r + g, this.elements[13] = a * t + l * n + p * r + _, this.elements[14] = o * t + u * n + m * r + v, this.elements[15] = s * t + d * n + h * r + y, this;
|
|
201
|
-
}
|
|
202
212
|
lookAt(e, t, n) {
|
|
203
213
|
let { x: r, y: i, z: a } = e, { x: o, y: s, z: l } = n, u = e.x - t.x, d = e.y - t.y, f = e.z - t.z, p = Math.sqrt(u ** 2 + d ** 2 + f ** 2);
|
|
204
214
|
if (p < EPSILON$1) return this;
|
|
@@ -318,7 +328,7 @@ var INDEX_X$3 = 0, INDEX_Y$2 = 1, INDEX_Z$1 = 2, INDEX_W = 3, Vector4 = class e
|
|
|
318
328
|
}
|
|
319
329
|
applyQuaternion(t) {
|
|
320
330
|
let { tmpMatrix4: n } = e;
|
|
321
|
-
n.
|
|
331
|
+
n.setRotation(t);
|
|
322
332
|
let { x: r, y: i, z: a } = n._applyVector(this.x, this.y, this.z, 0);
|
|
323
333
|
return this.set(r, i, a), this;
|
|
324
334
|
}
|
|
@@ -604,7 +614,7 @@ var INDEX_X$3 = 0, INDEX_Y$2 = 1, INDEX_Z$1 = 2, INDEX_W = 3, Vector4 = class e
|
|
|
604
614
|
}
|
|
605
615
|
applyQuaternion(t) {
|
|
606
616
|
let { tmpMatrix4: n } = e;
|
|
607
|
-
n.
|
|
617
|
+
n.setRotation(t);
|
|
608
618
|
let { x: r } = n._applyVector(this.x, 0, 0, 0);
|
|
609
619
|
return this.set(r), this;
|
|
610
620
|
}
|
|
@@ -693,7 +703,7 @@ var INDEX_X$3 = 0, INDEX_Y$2 = 1, INDEX_Z$1 = 2, INDEX_W = 3, Vector4 = class e
|
|
|
693
703
|
}
|
|
694
704
|
applyQuaternion(t) {
|
|
695
705
|
let { tmpMatrix4: n } = e;
|
|
696
|
-
n.
|
|
706
|
+
n.setRotation(t);
|
|
697
707
|
let { x: r, y: i } = n._applyVector(this.x, this.y, 0, 0);
|
|
698
708
|
return this.set(r, i), this;
|
|
699
709
|
}
|
package/dist/mathue.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.mathue={}))})(this,function(e){function*t(e,t){let n=t?.start??0,r=t?.step??1;if(r!==0&&!(r>0&&n>e)&&!(r<0&&n<e))for(let t=n;r>0?t<e:t>e;t+=r)yield t}function n(e){let t=0;for(let n of e)t+=n;return t}function r(e,t){let n=0;for(let r of e)n+=t(r)??0;return n}var i=0,a=1,o=2,s=3,c=class e{dimension=4;elements;static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=u.identity(),this._tmpMatrix4}constructor(e,t,n,r){this.elements=[e,t,n,r]}get x(){return this.elements[i]}set x(e){this.elements[i]=e}get y(){return this.elements[a]}set y(e){this.elements[a]=e}get z(){return this.elements[o]}set z(e){this.elements[o]=e}get w(){return this.elements[s]}set w(e){this.elements[s]=e}static zero(){return new e(0,0,0,0)}static one(){return new e(1,1,1,1)}clone(){let{x:t,y:n,z:r,w:i}=this;return new e(t,n,r,i)}isZero(){let{x:e,y:t,z:n,w:r}=this;return e===0&&t===0&&n===0&&r===0}set(e,t,n,r){this.x=e,this.y=t,this.z=n,this.w=r}copy(e){let{x:t,y:n,z:r,w:i}=e;this.set(t,n,r,i)}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}subtract(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}divideScalar(e){return this.x/=e,this.y/=e,this.z/=e,this.w/=e,this}length(){let{x:e,y:t,z:n,w:r}=this;return Math.sqrt(e**2+t**2+n**2+r**2)}normalize(){let e=this.length();return e<=0?this:this.divideScalar(e)}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r,y:i,z:a,w:o}=this,s=n._applyVector(r,i,a,o);return this.copy(s),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setQuaternion(t);let{x:r,y:i,z:a,w:o}=this,s=n._applyVector(r,i,a,o);return this.copy(s),this}},l=1e-8,u=class e{order=4;elements;static _tmpMatrix;static get tmpMatrix(){return this._tmpMatrix||=e.identity(),this._tmpMatrix}static _tmpVector;static get tmpVector(){return this._tmpVector||=c.zero(),this._tmpVector}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=Float32Array.of(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}static identity(){return e.zero().setIdentity()}static zero(){return new e(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}clone(){let[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]=this.elements;return new e(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){return this.elements[0]=e,this.elements[1]=t,this.elements[2]=n,this.elements[3]=r,this.elements[4]=i,this.elements[5]=a,this.elements[6]=o,this.elements[7]=s,this.elements[8]=c,this.elements[9]=l,this.elements[10]=u,this.elements[11]=d,this.elements[12]=f,this.elements[13]=p,this.elements[14]=m,this.elements[15]=h,this}copy(e){let[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]=e.elements;this.set(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}setIdentity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}setQuaternion(e){let{a:t,b:n,c:r,d:i}=e,a=2/e.squaredNorm(),o=n**2,s=r**2,c=i**2,l=t*n,u=t*r,d=t*i,f=n*r,p=n*i,m=r*i;return this.set(1-a*(s+c),a*(f-d),a*(p+u),0,a*(f+d),1-a*(o+c),a*(m-l),0,a*(p-u),a*(m+l),1-a*(o+s),0,0,0,0,1),this}add(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]+=e.elements[r];return this}subtract(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]-=e.elements[r];return this}multiplyScalar(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]*=e;return this}divideScalar(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]/=e;return this}multiply(e){let[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]=this.elements,[_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M]=e.elements;return this.elements[0]=_*t+v*a+y*l+b*p,this.elements[1]=_*n+v*o+y*u+b*m,this.elements[2]=_*r+v*s+y*d+b*h,this.elements[3]=_*i+v*c+y*f+b*g,this.elements[4]=x*t+S*a+C*l+w*p,this.elements[5]=x*n+S*o+C*u+w*m,this.elements[6]=x*r+S*s+C*d+w*h,this.elements[7]=x*i+S*c+C*f+w*g,this.elements[8]=T*t+E*a+D*l+O*p,this.elements[9]=T*n+E*o+D*u+O*m,this.elements[10]=T*r+E*s+D*d+O*h,this.elements[11]=T*i+E*c+D*f+O*g,this.elements[12]=k*t+A*a+j*l+M*p,this.elements[13]=k*n+A*o+j*u+M*m,this.elements[14]=k*r+A*s+j*d+M*h,this.elements[15]=k*i+A*c+j*f+M*g,this}determinant(){let[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]=this.elements;return e*(a*(u*h-d*m)-o*(l*h-d*p)+s*(l*m-u*p))-t*(i*(u*h-d*m)-o*(c*h-d*f)+s*(c*m-u*f))+n*(i*(l*h-d*p)-a*(c*h-d*f)+s*(c*p-l*f))-r*(i*(l*m-u*p)-a*(c*m-u*f)+o*(c*p-l*f))}invert(){let e=this.determinant();if(Math.abs(e)<l)return null;let[t,n,r,i,a,o,s,c,u,d,f,p,m,h,g,_]=this.elements,v=f*_-p*g,y=d*_-p*h,b=d*g-f*h,x=s*_-c*g,S=o*_-c*h,C=o*g-s*h,w=s*p-c*f,T=o*p-c*d,E=o*f-s*d,D=u*_-p*m,O=u*g-f*m,k=a*_-c*m,A=a*g-s*m,j=a*p-c*u,M=a*f-s*u,N=u*h-d*m,P=a*h-o*m,F=a*d-o*u;return this.elements[0]=(o*v-s*y+c*b)/e,this.elements[1]=-(n*v-r*y+i*b)/e,this.elements[2]=(n*x-r*S+i*C)/e,this.elements[3]=-(n*w-r*T+i*E)/e,this.elements[4]=-(a*v-s*D+c*O)/e,this.elements[5]=(t*v-r*D+i*O)/e,this.elements[6]=-(t*x-r*k+i*A)/e,this.elements[7]=(t*w-r*j+i*M)/e,this.elements[8]=(a*y-o*D+c*N)/e,this.elements[9]=-(t*y-n*D+i*N)/e,this.elements[10]=(t*S-n*k+i*P)/e,this.elements[11]=-(t*T-n*j+i*F)/e,this.elements[12]=-(a*b-o*O+s*N)/e,this.elements[13]=(t*b-n*O+r*N)/e,this.elements[14]=-(t*C-n*A+r*P)/e,this.elements[15]=(t*E-n*M+r*F)/e,this}transpose(){let[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]=this.elements;return this.elements[1]=i,this.elements[2]=c,this.elements[3]=f,this.elements[4]=t,this.elements[6]=l,this.elements[7]=p,this.elements[8]=n,this.elements[9]=o,this.elements[11]=m,this.elements[12]=r,this.elements[13]=s,this.elements[14]=d,this}divide(t){let{tmpMatrix:n}=e;return n.copy(t),n.invert()?this.multiply(n):null}scale(e){let{order:n}=this;for(let r of t(n)){let i=r===n-1?1:e.elements[r];for(let e of t(n)){let t=r*n+e;this.elements[t]*=i}}return this}translate(e){let{x:t,y:n,z:r}=e,[i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y]=this.elements;return this.elements[12]=i*t+c*n+f*r+g,this.elements[13]=a*t+l*n+p*r+_,this.elements[14]=o*t+u*n+m*r+v,this.elements[15]=s*t+d*n+h*r+y,this}lookAt(e,t,n){let{x:r,y:i,z:a}=e,{x:o,y:s,z:c}=n,u=e.x-t.x,d=e.y-t.y,f=e.z-t.z,p=Math.sqrt(u**2+d**2+f**2);if(p<l)return this;u/=p,d/=p,f/=p;let m=s*f-c*d,h=c*u-o*f,g=o*d-s*u,_=Math.sqrt(m**2+h**2+g**2);_>0&&(m/=_,h/=_,g/=_);let v=d*g-f*h,y=f*m-u*g,b=u*h-d*m,x=Math.sqrt(v**2+y**2+b**2);x>0&&(v/=x,y/=x,b/=x);let S=-(m*r+h*i+g*a),C=-(v*r+y*i+b*a),w=-(u*r+d*i+f*a);return this.set(m,v,u,0,h,y,d,0,g,b,f,0,S,C,w,1),this}perspective(e,t,n,r){let i=1/Math.tan(e/2);return this.set(i/r,0,0,0,0,i,0,0,0,0,1,-1,0,0,1,0),n===1/0?(this.elements[10]=-1,this.elements[14]=-2*t):(this.elements[10]=-(n+t)/(n-t),this.elements[14]=-2*n*t/(n-t)),this}_applyVector(t,n,r,i){let{tmpVector:a}=e;a.set(t,n,r,i);let[o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x]=this.elements,S=o*t+u*n+m*r+v*i,C=s*t+d*n+h*r+y*i,w=c*t+f*n+g*r+b*i,T=l*t+p*n+_*r+x*i;return a.set(S,C,w,T),a}},d=0,f=1,p=2,m=class e{dimension=3;elements;static _tmpMatrix3;static get tmpMatrix3(){return this._tmpMatrix3||=g.identity(),this._tmpMatrix3}static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=u.identity(),this._tmpMatrix4}constructor(e,t,n){this.elements=[e,t,n]}get x(){return this.elements[d]}set x(e){this.elements[d]=e}get y(){return this.elements[f]}set y(e){this.elements[f]=e}get z(){return this.elements[p]}set z(e){this.elements[p]=e}static zero(){return new e(0,0,0)}static one(){return new e(1,1,1)}clone(){let{x:t,y:n,z:r}=this;return new e(t,n,r)}isZero(){let{x:e,y:t,z:n}=this;return e===0&&t===0&&n===0}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}copy(e){let{x:t,y:n,z:r}=e;return this.set(t,n,r)}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}subtract(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}divideScalar(e){return this.x/=e,this.y/=e,this.z/=e,this}length(){let{x:e,y:t,z:n}=this;return Math.sqrt(e**2+t**2+n**2)}normalize(){let e=this.length();return e<=0?this:this.divideScalar(e)}cross(e){let{x:t,y:n,z:r}=this,{x:i,y:a,z:o}=e,s=n*o-r*a,c=r*i-t*o,l=t*a-n*i;return this.set(s,c,l)}crossTo(e,t){return t.copy(this),t.cross(e)}applyMatrix3(t){let{tmpMatrix3:n}=e;n.copy(t);let{x:r,y:i,z:a}=n._applyVector(this.x,this.y,this.z);return this.set(r,i,a),this}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r,y:i,z:a}=n._applyVector(this.x,this.y,this.z,0);return this.set(r,i,a),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setQuaternion(t);let{x:r,y:i,z:a}=n._applyVector(this.x,this.y,this.z,0);return this.set(r,i,a),this}},h=1e-8,g=class e{order=3;elements;static _tmpMatrix;static get tmpMatrix(){return this._tmpMatrix||=e.identity(),this._tmpMatrix}static _tmpVector;static get tmpVector(){return this._tmpVector||=m.zero(),this._tmpVector}constructor(e,t,n,r,i,a,o,s,c){this.elements=Float32Array.of(e,t,n,r,i,a,o,s,c)}static identity(){return e.zero().setIdentity()}static zero(){return new e(0,0,0,0,0,0,0,0,0)}clone(){let[t,n,r,i,a,o,s,c,l]=this.elements;return new e(t,n,r,i,a,o,s,c,l)}set(e,t,n,r,i,a,o,s,c){return this.elements[0]=e,this.elements[1]=t,this.elements[2]=n,this.elements[3]=r,this.elements[4]=i,this.elements[5]=a,this.elements[6]=o,this.elements[7]=s,this.elements[8]=c,this}copy(e){let[t,n,r,i,a,o,s,c,l]=e.elements;this.set(t,n,r,i,a,o,s,c,l)}setIdentity(){return this.set(1,0,0,0,1,0,0,0,1),this}add(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]+=e.elements[r];return this}subtract(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]-=e.elements[r];return this}multiplyScalar(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]*=e;return this}divideScalar(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]/=e;return this}multiply(e){let[t,n,r,i,a,o,s,c,l]=this.elements,[u,d,f,p,m,h,g,_,v]=e.elements;return this.elements[0]=u*t+d*i+f*s,this.elements[1]=u*n+d*a+f*c,this.elements[2]=u*r+d*o+f*l,this.elements[3]=p*t+m*i+h*s,this.elements[4]=p*n+m*a+h*c,this.elements[5]=p*r+m*o+h*l,this.elements[6]=g*t+_*i+v*s,this.elements[7]=g*n+_*a+v*c,this.elements[8]=g*r+_*o+v*l,this}determinant(){let[e,t,n,r,i,a,o,s,c]=this.elements;return e*(c*i-a*s)+t*(-c*r+a*o)+n*(s*r-i*o)}invert(){let e=this.determinant();if(Math.abs(e)<h)return null;let[t,n,r,i,a,o,s,c,l]=this.elements,u=l*a-o*c,d=-l*i+o*s,f=c*i-a*s;return this.elements[0]=u/e,this.elements[1]=(-l*n+r*c)/e,this.elements[2]=(o*n-r*a)/e,this.elements[3]=d/e,this.elements[4]=(l*t-r*s)/e,this.elements[5]=(-o*t+r*i)/e,this.elements[6]=f/e,this.elements[7]=(-c*t+n*s)/e,this.elements[8]=(a*t-n*i)/e,this}transpose(){let[e,t,n,r,i,a,o,s,c]=this.elements;return this.elements[1]=r,this.elements[2]=o,this.elements[3]=t,this.elements[5]=s,this.elements[6]=n,this.elements[7]=a,this}divide(t){let{tmpMatrix:n}=e;return n.copy(t),n.invert()?this.multiply(n):null}_applyVector(t,n,r){let{tmpVector:i}=e;i.set(t,n,r);let[a,o,s,c,l,u,d,f,p]=this.elements,m=a*t+c*n+d*r,h=o*t+l*n+f*r,g=s*t+u*n+p*r;return i.set(m,h,g),i}},_=class{_phi;_theta;_radius;constructor(e,t,n){this._phi=e,this._theta=t,this._radius=n}get phi(){return this._phi}set phi(e){this._phi=e}get theta(){return this._theta}set theta(e){this._theta=e}get radius(){return this._radius}set radius(e){this._radius=e}toVector3(e){let{phi:t,theta:n,radius:r}=this,{cos:i,sin:a}=Math,o=a(n),s=r*o*i(t),c=r*o*a(t),l=r*i(n);e.set(s,c,l)}toTangentZ(e){let{phi:t,theta:n}=this,{cos:r,sin:i}=Math,a=r(n),o=-a*r(t),s=-a*i(t),c=i(n);e.set(o,s,c)}},v=class e{_a;_b;_c;_d;static temporary=e.identity();constructor(e,t,n,r){this._a=e,this._b=t,this._c=n,this._d=r}get a(){return this._a}get b(){return this._b}get c(){return this._c}get d(){return this._d}static identity(){return new e(1,0,0,0)}static fromAxisAndAngle(t,n){let r=e.identity();return r.setAxisAndAngle(t,n),r}clone(){let{a:t,b:n,c:r,d:i}=this;return new e(t,n,r,i)}set(e,t,n,r){return this._a=e,this._b=t,this._c=n,this._d=r,this}copy(e){let{a:t,b:n,c:r,d:i}=e;return this.set(t,n,r,i)}setIdentity(){this.set(1,0,0,0)}setAxisAndAngle(e,t){if(e.isZero())return this.setIdentity();e.normalize();let{x:n,y:r,z:i}=e,a=Math.sin(t/2);this.set(Math.cos(t/2),n*a,r*a,i*a)}squaredNorm(){let{a:e,b:t,c:n,d:r}=this;return e**2+t**2+n**2+r**2}norm(){return Math.sqrt(this.squaredNorm())}conjugate(){return this._b*=-1,this._c*=-1,this._d*=-1,this}add(e){let{a:t,b:n,c:r,d:i}=e;return this._a+=t,this._b+=n,this._c+=r,this._d+=i,this}subtract(e){let{a:t,b:n,c:r,d:i}=e;return this._a-=t,this._b-=n,this._c-=r,this._d-=i,this}multiply(e){let{a:t,b:n,c:r,d:i}=this,{a,b:o,c:s,d:c}=e;return this._a=t*a-n*o-r*s-i*c,this._b=t*o+n*a+r*c-i*s,this._c=t*s-n*c+r*a+i*o,this._d=t*c+n*s-r*o+i*a,this}invert(){let e=this.squaredNorm();return e<=0?null:this.conjugate().divideScalar(e)}divide(t){let{temporary:n}=e;return n.copy(t),n.invert()?this.multiply(n):null}multiplyScalar(e){return this._a*=e,this._b*=e,this._c*=e,this._d*=e,this}divideScalar(e){return this._a/=e,this._b/=e,this._c/=e,this._d/=e,this}rotateX(t){let{temporary:n}=e;return n.setIdentity(),n.setAxisAndAngle(new m(1,0,0),t),this.multiply(n)}rotateY(t){let{temporary:n}=e;return n.setIdentity(),n.setAxisAndAngle(new m(0,1,0),t),this.multiply(n)}rotateZ(t){let{temporary:n}=e;return n.setIdentity(),n.setAxisAndAngle(new m(0,0,1),t),this.multiply(n)}},y=0,b=class e{dimension=1;elements;static _tmpMatrix3;static get tmpMatrix3(){return this._tmpMatrix3||=g.identity(),this._tmpMatrix3}static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=u.identity(),this._tmpMatrix4}constructor(e){this.elements=[e]}get x(){return this.elements[y]}set x(e){this.elements[y]=e}static zero(){return new e(0)}static one(){return new e(1)}clone(){let{x:t}=this;return new e(t)}isZero(){return this.x===0}set(e){return this.x=e,this}copy(e){return this.x=e.x,this}add(e){return this.x+=e.x,this}subtract(e){return this.x-=e.x,this}multiplyScalar(e){return this.x*=e,this}divideScalar(e){return this.x/=e,this}length(){return Math.abs(this.x)}normalize(){return this.x/=this.length(),this}applyMatrix3(t){let{tmpMatrix3:n}=e;n.copy(t);let{x:r}=n._applyVector(this.x,0,0);return this.set(r),this}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r}=n._applyVector(this.x,0,0,0);return this.set(r),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setQuaternion(t);let{x:r}=n._applyVector(this.x,0,0,0);return this.set(r),this}},x=0,S=1,C=class e{dimension=2;elements;static _tmpMatrix3;static get tmpMatrix3(){return this._tmpMatrix3||=g.identity(),this._tmpMatrix3}static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=u.identity(),this._tmpMatrix4}constructor(e,t){this.elements=[e,t]}get x(){return this.elements[x]}set x(e){this.elements[x]=e}get y(){return this.elements[S]}set y(e){this.elements[S]=e}static zero(){return new e(0,0)}static one(){return new e(1,1)}clone(){let{x:t,y:n}=this;return new e(t,n)}isZero(){let{x:e,y:t}=this;return e===0&&t===0}set(e,t){return this.x=e,this.y=t,this}copy(e){let{x:t,y:n}=e;return this.set(t,n)}add(e){return this.x+=e.x,this.y+=e.y,this}subtract(e){return this.x-=e.x,this.y-=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divideScalar(e){return this.x/=e,this.y/=e,this}length(){let{x:e,y:t}=this;return Math.sqrt(e**2+t**2)}normalize(){let e=this.length();return e<=0?this:this.divideScalar(e)}rotate(e){let{cos:t,sin:n}=Math,r=this.x*t(e)-this.y*n(e),i=this.x*n(e)+this.y*t(e);return this.x=r,this.y=i,this}applyMatrix3(t){let{tmpMatrix3:n}=e;n.copy(t);let{x:r,y:i}=n._applyVector(this.x,this.y,0);return this.set(r,i),this}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r,y:i}=n._applyVector(this.x,this.y,0,0);return this.set(r,i),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setQuaternion(t);let{x:r,y:i}=n._applyVector(this.x,this.y,0,0);return this.set(r,i),this}};e.Matrix3=g,e.Matrix4=u,e.PolarCoordinate3=_,e.Quaternion=v,e.Vector1=b,e.Vector2=C,e.Vector3=m,e.Vector4=c,e.range=t,e.sum=n,e.sumMap=r});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.mathue={}))})(this,function(e){function*t(e,t){let n=t?.start??0,r=t?.step??1;if(r!==0&&!(r>0&&n>e)&&!(r<0&&n<e))for(let t=n;r>0?t<e:t>e;t+=r)yield t}function n(e){let t=0;for(let n of e)t+=n;return t}function r(e,t){let n=0;for(let r of e)n+=t(r)??0;return n}var i=0,a=1,o=2,s=3,c=class e{dimension=4;elements;static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=u.identity(),this._tmpMatrix4}constructor(e,t,n,r){this.elements=[e,t,n,r]}get x(){return this.elements[i]}set x(e){this.elements[i]=e}get y(){return this.elements[a]}set y(e){this.elements[a]=e}get z(){return this.elements[o]}set z(e){this.elements[o]=e}get w(){return this.elements[s]}set w(e){this.elements[s]=e}static zero(){return new e(0,0,0,0)}static one(){return new e(1,1,1,1)}clone(){let{x:t,y:n,z:r,w:i}=this;return new e(t,n,r,i)}isZero(){let{x:e,y:t,z:n,w:r}=this;return e===0&&t===0&&n===0&&r===0}set(e,t,n,r){this.x=e,this.y=t,this.z=n,this.w=r}copy(e){let{x:t,y:n,z:r,w:i}=e;this.set(t,n,r,i)}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}subtract(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}divideScalar(e){return this.x/=e,this.y/=e,this.z/=e,this.w/=e,this}length(){let{x:e,y:t,z:n,w:r}=this;return Math.sqrt(e**2+t**2+n**2+r**2)}normalize(){let e=this.length();return e<=0?this:this.divideScalar(e)}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r,y:i,z:a,w:o}=this,s=n._applyVector(r,i,a,o);return this.copy(s),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setRotation(t);let{x:r,y:i,z:a,w:o}=this,s=n._applyVector(r,i,a,o);return this.copy(s),this}},l=1e-8,u=class e{order=4;elements;static _tmpMatrix;static get tmpMatrix(){return this._tmpMatrix||=e.identity(),this._tmpMatrix}static _tmpVector;static get tmpVector(){return this._tmpVector||=c.zero(),this._tmpVector}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=Float32Array.of(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}static identity(){return e.zero().setIdentity()}static zero(){return new e(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}clone(){let[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]=this.elements;return new e(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){return this.elements[0]=e,this.elements[1]=t,this.elements[2]=n,this.elements[3]=r,this.elements[4]=i,this.elements[5]=a,this.elements[6]=o,this.elements[7]=s,this.elements[8]=c,this.elements[9]=l,this.elements[10]=u,this.elements[11]=d,this.elements[12]=f,this.elements[13]=p,this.elements[14]=m,this.elements[15]=h,this}copy(e){let[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]=e.elements;this.set(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}setIdentity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}setScale(e){this.setIdentity();let{order:n}=this;for(let r of t(n)){let i=r===n-1?1:e.elements[r];for(let e of t(n)){let t=r*n+e;this.elements[t]*=i}}return this}setTranslation(e){let{x:t,y:n,z:r}=e,[i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y]=this.elements;return this.setIdentity(),this.elements[12]=i*t+c*n+f*r+g,this.elements[13]=a*t+l*n+p*r+_,this.elements[14]=o*t+u*n+m*r+v,this.elements[15]=s*t+d*n+h*r+y,this}setRotation(e){let{a:t,b:n,c:r,d:i}=e,a=2/e.squaredNorm(),o=n**2,s=r**2,c=i**2,l=t*n,u=t*r,d=t*i,f=n*r,p=n*i,m=r*i;return this.set(1-a*(s+c),a*(f-d),a*(p+u),0,a*(f+d),1-a*(o+c),a*(m-l),0,a*(p-u),a*(m+l),1-a*(o+s),0,0,0,0,1),this}add(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]+=e.elements[r];return this}subtract(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]-=e.elements[r];return this}multiplyScalar(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]*=e;return this}divideScalar(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]/=e;return this}multiply(e){let[t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]=this.elements,[_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M]=e.elements;return this.elements[0]=_*t+v*a+y*l+b*p,this.elements[1]=_*n+v*o+y*u+b*m,this.elements[2]=_*r+v*s+y*d+b*h,this.elements[3]=_*i+v*c+y*f+b*g,this.elements[4]=x*t+S*a+C*l+w*p,this.elements[5]=x*n+S*o+C*u+w*m,this.elements[6]=x*r+S*s+C*d+w*h,this.elements[7]=x*i+S*c+C*f+w*g,this.elements[8]=T*t+E*a+D*l+O*p,this.elements[9]=T*n+E*o+D*u+O*m,this.elements[10]=T*r+E*s+D*d+O*h,this.elements[11]=T*i+E*c+D*f+O*g,this.elements[12]=k*t+A*a+j*l+M*p,this.elements[13]=k*n+A*o+j*u+M*m,this.elements[14]=k*r+A*s+j*d+M*h,this.elements[15]=k*i+A*c+j*f+M*g,this}multiplyScale(t){return this.multiply(e.tmpMatrix.setScale(t))}multiplyTranslation(t){return this.multiply(e.tmpMatrix.setTranslation(t))}multiplyRotation(t){return this.multiply(e.tmpMatrix.setRotation(t))}determinant(){let[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]=this.elements;return e*(a*(u*h-d*m)-o*(l*h-d*p)+s*(l*m-u*p))-t*(i*(u*h-d*m)-o*(c*h-d*f)+s*(c*m-u*f))+n*(i*(l*h-d*p)-a*(c*h-d*f)+s*(c*p-l*f))-r*(i*(l*m-u*p)-a*(c*m-u*f)+o*(c*p-l*f))}invert(){let e=this.determinant();if(Math.abs(e)<l)return null;let[t,n,r,i,a,o,s,c,u,d,f,p,m,h,g,_]=this.elements,v=f*_-p*g,y=d*_-p*h,b=d*g-f*h,x=s*_-c*g,S=o*_-c*h,C=o*g-s*h,w=s*p-c*f,T=o*p-c*d,E=o*f-s*d,D=u*_-p*m,O=u*g-f*m,k=a*_-c*m,A=a*g-s*m,j=a*p-c*u,M=a*f-s*u,N=u*h-d*m,P=a*h-o*m,F=a*d-o*u;return this.elements[0]=(o*v-s*y+c*b)/e,this.elements[1]=-(n*v-r*y+i*b)/e,this.elements[2]=(n*x-r*S+i*C)/e,this.elements[3]=-(n*w-r*T+i*E)/e,this.elements[4]=-(a*v-s*D+c*O)/e,this.elements[5]=(t*v-r*D+i*O)/e,this.elements[6]=-(t*x-r*k+i*A)/e,this.elements[7]=(t*w-r*j+i*M)/e,this.elements[8]=(a*y-o*D+c*N)/e,this.elements[9]=-(t*y-n*D+i*N)/e,this.elements[10]=(t*S-n*k+i*P)/e,this.elements[11]=-(t*T-n*j+i*F)/e,this.elements[12]=-(a*b-o*O+s*N)/e,this.elements[13]=(t*b-n*O+r*N)/e,this.elements[14]=-(t*C-n*A+r*P)/e,this.elements[15]=(t*E-n*M+r*F)/e,this}transpose(){let[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]=this.elements;return this.elements[1]=i,this.elements[2]=c,this.elements[3]=f,this.elements[4]=t,this.elements[6]=l,this.elements[7]=p,this.elements[8]=n,this.elements[9]=o,this.elements[11]=m,this.elements[12]=r,this.elements[13]=s,this.elements[14]=d,this}divide(t){let{tmpMatrix:n}=e;return n.copy(t),n.invert()?this.multiply(n):null}lookAt(e,t,n){let{x:r,y:i,z:a}=e,{x:o,y:s,z:c}=n,u=e.x-t.x,d=e.y-t.y,f=e.z-t.z,p=Math.sqrt(u**2+d**2+f**2);if(p<l)return this;u/=p,d/=p,f/=p;let m=s*f-c*d,h=c*u-o*f,g=o*d-s*u,_=Math.sqrt(m**2+h**2+g**2);_>0&&(m/=_,h/=_,g/=_);let v=d*g-f*h,y=f*m-u*g,b=u*h-d*m,x=Math.sqrt(v**2+y**2+b**2);x>0&&(v/=x,y/=x,b/=x);let S=-(m*r+h*i+g*a),C=-(v*r+y*i+b*a),w=-(u*r+d*i+f*a);return this.set(m,v,u,0,h,y,d,0,g,b,f,0,S,C,w,1),this}perspective(e,t,n,r){let i=1/Math.tan(e/2);return this.set(i/r,0,0,0,0,i,0,0,0,0,1,-1,0,0,1,0),n===1/0?(this.elements[10]=-1,this.elements[14]=-2*t):(this.elements[10]=-(n+t)/(n-t),this.elements[14]=-2*n*t/(n-t)),this}_applyVector(t,n,r,i){let{tmpVector:a}=e;a.set(t,n,r,i);let[o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x]=this.elements,S=o*t+u*n+m*r+v*i,C=s*t+d*n+h*r+y*i,w=c*t+f*n+g*r+b*i,T=l*t+p*n+_*r+x*i;return a.set(S,C,w,T),a}},d=0,f=1,p=2,m=class e{dimension=3;elements;static _tmpMatrix3;static get tmpMatrix3(){return this._tmpMatrix3||=g.identity(),this._tmpMatrix3}static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=u.identity(),this._tmpMatrix4}constructor(e,t,n){this.elements=[e,t,n]}get x(){return this.elements[d]}set x(e){this.elements[d]=e}get y(){return this.elements[f]}set y(e){this.elements[f]=e}get z(){return this.elements[p]}set z(e){this.elements[p]=e}static zero(){return new e(0,0,0)}static one(){return new e(1,1,1)}clone(){let{x:t,y:n,z:r}=this;return new e(t,n,r)}isZero(){let{x:e,y:t,z:n}=this;return e===0&&t===0&&n===0}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}copy(e){let{x:t,y:n,z:r}=e;return this.set(t,n,r)}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}subtract(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}divideScalar(e){return this.x/=e,this.y/=e,this.z/=e,this}length(){let{x:e,y:t,z:n}=this;return Math.sqrt(e**2+t**2+n**2)}normalize(){let e=this.length();return e<=0?this:this.divideScalar(e)}cross(e){let{x:t,y:n,z:r}=this,{x:i,y:a,z:o}=e,s=n*o-r*a,c=r*i-t*o,l=t*a-n*i;return this.set(s,c,l)}crossTo(e,t){return t.copy(this),t.cross(e)}applyMatrix3(t){let{tmpMatrix3:n}=e;n.copy(t);let{x:r,y:i,z:a}=n._applyVector(this.x,this.y,this.z);return this.set(r,i,a),this}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r,y:i,z:a}=n._applyVector(this.x,this.y,this.z,0);return this.set(r,i,a),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setRotation(t);let{x:r,y:i,z:a}=n._applyVector(this.x,this.y,this.z,0);return this.set(r,i,a),this}},h=1e-8,g=class e{order=3;elements;static _tmpMatrix;static get tmpMatrix(){return this._tmpMatrix||=e.identity(),this._tmpMatrix}static _tmpVector;static get tmpVector(){return this._tmpVector||=m.zero(),this._tmpVector}constructor(e,t,n,r,i,a,o,s,c){this.elements=Float32Array.of(e,t,n,r,i,a,o,s,c)}static identity(){return e.zero().setIdentity()}static zero(){return new e(0,0,0,0,0,0,0,0,0)}clone(){let[t,n,r,i,a,o,s,c,l]=this.elements;return new e(t,n,r,i,a,o,s,c,l)}set(e,t,n,r,i,a,o,s,c){return this.elements[0]=e,this.elements[1]=t,this.elements[2]=n,this.elements[3]=r,this.elements[4]=i,this.elements[5]=a,this.elements[6]=o,this.elements[7]=s,this.elements[8]=c,this}copy(e){let[t,n,r,i,a,o,s,c,l]=e.elements;this.set(t,n,r,i,a,o,s,c,l)}setIdentity(){return this.set(1,0,0,0,1,0,0,0,1),this}add(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]+=e.elements[r];return this}subtract(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]-=e.elements[r];return this}multiplyScalar(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]*=e;return this}divideScalar(e){let{order:n}=this;for(let r of t(n**2))this.elements[r]/=e;return this}multiply(e){let[t,n,r,i,a,o,s,c,l]=this.elements,[u,d,f,p,m,h,g,_,v]=e.elements;return this.elements[0]=u*t+d*i+f*s,this.elements[1]=u*n+d*a+f*c,this.elements[2]=u*r+d*o+f*l,this.elements[3]=p*t+m*i+h*s,this.elements[4]=p*n+m*a+h*c,this.elements[5]=p*r+m*o+h*l,this.elements[6]=g*t+_*i+v*s,this.elements[7]=g*n+_*a+v*c,this.elements[8]=g*r+_*o+v*l,this}determinant(){let[e,t,n,r,i,a,o,s,c]=this.elements;return e*(c*i-a*s)+t*(-c*r+a*o)+n*(s*r-i*o)}invert(){let e=this.determinant();if(Math.abs(e)<h)return null;let[t,n,r,i,a,o,s,c,l]=this.elements,u=l*a-o*c,d=-l*i+o*s,f=c*i-a*s;return this.elements[0]=u/e,this.elements[1]=(-l*n+r*c)/e,this.elements[2]=(o*n-r*a)/e,this.elements[3]=d/e,this.elements[4]=(l*t-r*s)/e,this.elements[5]=(-o*t+r*i)/e,this.elements[6]=f/e,this.elements[7]=(-c*t+n*s)/e,this.elements[8]=(a*t-n*i)/e,this}transpose(){let[e,t,n,r,i,a,o,s,c]=this.elements;return this.elements[1]=r,this.elements[2]=o,this.elements[3]=t,this.elements[5]=s,this.elements[6]=n,this.elements[7]=a,this}divide(t){let{tmpMatrix:n}=e;return n.copy(t),n.invert()?this.multiply(n):null}_applyVector(t,n,r){let{tmpVector:i}=e;i.set(t,n,r);let[a,o,s,c,l,u,d,f,p]=this.elements,m=a*t+c*n+d*r,h=o*t+l*n+f*r,g=s*t+u*n+p*r;return i.set(m,h,g),i}},_=class{_phi;_theta;_radius;constructor(e,t,n){this._phi=e,this._theta=t,this._radius=n}get phi(){return this._phi}set phi(e){this._phi=e}get theta(){return this._theta}set theta(e){this._theta=e}get radius(){return this._radius}set radius(e){this._radius=e}toVector3(e){let{phi:t,theta:n,radius:r}=this,{cos:i,sin:a}=Math,o=a(n),s=r*o*i(t),c=r*o*a(t),l=r*i(n);e.set(s,c,l)}toTangentZ(e){let{phi:t,theta:n}=this,{cos:r,sin:i}=Math,a=r(n),o=-a*r(t),s=-a*i(t),c=i(n);e.set(o,s,c)}},v=class e{_a;_b;_c;_d;static temporary=e.identity();constructor(e,t,n,r){this._a=e,this._b=t,this._c=n,this._d=r}get a(){return this._a}get b(){return this._b}get c(){return this._c}get d(){return this._d}static identity(){return new e(1,0,0,0)}static fromAxisAndAngle(t,n){let r=e.identity();return r.setAxisAndAngle(t,n),r}clone(){let{a:t,b:n,c:r,d:i}=this;return new e(t,n,r,i)}set(e,t,n,r){return this._a=e,this._b=t,this._c=n,this._d=r,this}copy(e){let{a:t,b:n,c:r,d:i}=e;return this.set(t,n,r,i)}setIdentity(){this.set(1,0,0,0)}setAxisAndAngle(e,t){if(e.isZero())return this.setIdentity();e.normalize();let{x:n,y:r,z:i}=e,a=Math.sin(t/2);this.set(Math.cos(t/2),n*a,r*a,i*a)}squaredNorm(){let{a:e,b:t,c:n,d:r}=this;return e**2+t**2+n**2+r**2}norm(){return Math.sqrt(this.squaredNorm())}conjugate(){return this._b*=-1,this._c*=-1,this._d*=-1,this}add(e){let{a:t,b:n,c:r,d:i}=e;return this._a+=t,this._b+=n,this._c+=r,this._d+=i,this}subtract(e){let{a:t,b:n,c:r,d:i}=e;return this._a-=t,this._b-=n,this._c-=r,this._d-=i,this}multiply(e){let{a:t,b:n,c:r,d:i}=this,{a,b:o,c:s,d:c}=e;return this._a=t*a-n*o-r*s-i*c,this._b=t*o+n*a+r*c-i*s,this._c=t*s-n*c+r*a+i*o,this._d=t*c+n*s-r*o+i*a,this}invert(){let e=this.squaredNorm();return e<=0?null:this.conjugate().divideScalar(e)}divide(t){let{temporary:n}=e;return n.copy(t),n.invert()?this.multiply(n):null}multiplyScalar(e){return this._a*=e,this._b*=e,this._c*=e,this._d*=e,this}divideScalar(e){return this._a/=e,this._b/=e,this._c/=e,this._d/=e,this}rotateX(t){let{temporary:n}=e;return n.setIdentity(),n.setAxisAndAngle(new m(1,0,0),t),this.multiply(n)}rotateY(t){let{temporary:n}=e;return n.setIdentity(),n.setAxisAndAngle(new m(0,1,0),t),this.multiply(n)}rotateZ(t){let{temporary:n}=e;return n.setIdentity(),n.setAxisAndAngle(new m(0,0,1),t),this.multiply(n)}},y=0,b=class e{dimension=1;elements;static _tmpMatrix3;static get tmpMatrix3(){return this._tmpMatrix3||=g.identity(),this._tmpMatrix3}static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=u.identity(),this._tmpMatrix4}constructor(e){this.elements=[e]}get x(){return this.elements[y]}set x(e){this.elements[y]=e}static zero(){return new e(0)}static one(){return new e(1)}clone(){let{x:t}=this;return new e(t)}isZero(){return this.x===0}set(e){return this.x=e,this}copy(e){return this.x=e.x,this}add(e){return this.x+=e.x,this}subtract(e){return this.x-=e.x,this}multiplyScalar(e){return this.x*=e,this}divideScalar(e){return this.x/=e,this}length(){return Math.abs(this.x)}normalize(){return this.x/=this.length(),this}applyMatrix3(t){let{tmpMatrix3:n}=e;n.copy(t);let{x:r}=n._applyVector(this.x,0,0);return this.set(r),this}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r}=n._applyVector(this.x,0,0,0);return this.set(r),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setRotation(t);let{x:r}=n._applyVector(this.x,0,0,0);return this.set(r),this}},x=0,S=1,C=class e{dimension=2;elements;static _tmpMatrix3;static get tmpMatrix3(){return this._tmpMatrix3||=g.identity(),this._tmpMatrix3}static _tmpMatrix4;static get tmpMatrix4(){return this._tmpMatrix4||=u.identity(),this._tmpMatrix4}constructor(e,t){this.elements=[e,t]}get x(){return this.elements[x]}set x(e){this.elements[x]=e}get y(){return this.elements[S]}set y(e){this.elements[S]=e}static zero(){return new e(0,0)}static one(){return new e(1,1)}clone(){let{x:t,y:n}=this;return new e(t,n)}isZero(){let{x:e,y:t}=this;return e===0&&t===0}set(e,t){return this.x=e,this.y=t,this}copy(e){let{x:t,y:n}=e;return this.set(t,n)}add(e){return this.x+=e.x,this.y+=e.y,this}subtract(e){return this.x-=e.x,this.y-=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divideScalar(e){return this.x/=e,this.y/=e,this}length(){let{x:e,y:t}=this;return Math.sqrt(e**2+t**2)}normalize(){let e=this.length();return e<=0?this:this.divideScalar(e)}rotate(e){let{cos:t,sin:n}=Math,r=this.x*t(e)-this.y*n(e),i=this.x*n(e)+this.y*t(e);return this.x=r,this.y=i,this}applyMatrix3(t){let{tmpMatrix3:n}=e;n.copy(t);let{x:r,y:i}=n._applyVector(this.x,this.y,0);return this.set(r,i),this}applyMatrix4(t){let{tmpMatrix4:n}=e;n.copy(t);let{x:r,y:i}=n._applyVector(this.x,this.y,0,0);return this.set(r,i),this}applyQuaternion(t){let{tmpMatrix4:n}=e;n.setRotation(t);let{x:r,y:i}=n._applyVector(this.x,this.y,0,0);return this.set(r,i),this}};e.Matrix3=g,e.Matrix4=u,e.PolarCoordinate3=_,e.Quaternion=v,e.Vector1=b,e.Vector2=C,e.Vector3=m,e.Vector4=c,e.range=t,e.sum=n,e.sumMap=r});
|
package/package.json
CHANGED
|
@@ -1,56 +1,62 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mathue",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "mathue",
|
|
3
|
+
"description": "TypeScript math library",
|
|
4
|
+
"version": "0.1.1",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"main": "dist/mathue.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/mathue.js",
|
|
16
|
+
"require": "./dist/mathue.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://sueuegunn.github.io/mathue",
|
|
20
|
+
"repository": {
|
|
21
|
+
"url": "https://github.com/sueuegunn/mathue"
|
|
22
|
+
},
|
|
23
|
+
"funding": {
|
|
24
|
+
"type": "github",
|
|
25
|
+
"url": "https://github.com/sponsors/sueuegunn"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"math",
|
|
29
|
+
"mathematics",
|
|
30
|
+
"linear-algebra",
|
|
31
|
+
"vector",
|
|
32
|
+
"matrix",
|
|
33
|
+
"quaternion",
|
|
34
|
+
"webgl",
|
|
35
|
+
"webgpu",
|
|
36
|
+
"graphics",
|
|
37
|
+
"3d",
|
|
38
|
+
"typescript",
|
|
39
|
+
"zero-allocation",
|
|
40
|
+
"performance"
|
|
41
|
+
],
|
|
42
|
+
"scripts": {
|
|
43
|
+
"dev": "vite",
|
|
44
|
+
"build": "tsc --noEmit && vite build",
|
|
45
|
+
"preview": "vite preview",
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"test:cov": "vitest run --coverage",
|
|
48
|
+
"docs": "typedoc"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^24.9.2",
|
|
52
|
+
"@vitest/coverage-v8": "^4.0.6",
|
|
53
|
+
"typedoc": "^0.28.15",
|
|
54
|
+
"typescript": "~5.9.3",
|
|
55
|
+
"vite": "npm:rolldown-vite@7.1.14",
|
|
56
|
+
"vite-plugin-dts": "^4.5.4",
|
|
57
|
+
"vitest": "^4.0.6"
|
|
58
|
+
},
|
|
59
|
+
"overrides": {
|
|
60
|
+
"vite": "npm:rolldown-vite@7.1.14"
|
|
61
|
+
}
|
|
62
|
+
}
|