File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ export { Sphere } from './math/Sphere.js';
122122export { Ray } from './math/Ray.js' ;
123123export { Matrix4 } from './math/Matrix4.js' ;
124124export { Matrix3 } from './math/Matrix3.js' ;
125+ export { Matrix2 } from './math/Matrix2.js' ;
125126export { Box3 } from './math/Box3.js' ;
126127export { Box2 } from './math/Box2.js' ;
127128export { Line3 } from './math/Line3.js' ;
Original file line number Diff line number Diff line change 1+ export class Matrix2 {
2+
3+ constructor ( n11 , n12 , n21 , n22 ) {
4+
5+ Matrix2 . prototype . isMatrix2 = true ;
6+
7+ this . elements = [
8+ 1 , 0 ,
9+ 0 , 1 ,
10+ ] ;
11+
12+ if ( n11 !== undefined ) {
13+
14+ this . set ( n11 , n12 , n21 , n22 ) ;
15+
16+ }
17+
18+ }
19+
20+ identity ( ) {
21+
22+ this . set (
23+ 1 , 0 ,
24+ 0 , 1 ,
25+ ) ;
26+
27+ return this ;
28+
29+ }
30+
31+ fromArray ( array , offset = 0 ) {
32+
33+ for ( let i = 0 ; i < 4 ; i ++ ) {
34+
35+ this . elements [ i ] = array [ i + offset ] ;
36+
37+ }
38+
39+ return this ;
40+
41+ }
42+
43+ set ( n11 , n12 , n21 , n22 ) {
44+
45+ const te = this . elements ;
46+
47+ te [ 0 ] = n11 ; te [ 2 ] = n12 ;
48+ te [ 1 ] = n21 ; te [ 3 ] = n22 ;
49+
50+ return this ;
51+
52+ }
53+
54+ }
You can’t perform that action at this time.
0 commit comments