1 /**
2 * @author alteredq / http://alteredqualia.com/
3 * @author WestLangley / http://github.com/WestLangley
4 */
5
6 /**@constructor*/
7 THREE.Matrix3 = function () {
8
9 this.elements = new Float32Array(9);
10
11 };
12
13 THREE.Matrix3.prototype = {
14
15 constructor: THREE.Matrix3,
16
17 multiplyVector3: function ( v ) {
18
19 var te = this.elements;
20
21 var vx = v.x, vy = v.y, vz = v.z;
22
23 v.x = te[0] * vx + te[3] * vy + te[6] * vz;
24 v.y = te[1] * vx + te[4] * vy + te[7] * vz;
25 v.z = te[2] * vx + te[5] * vy + te[8] * vz;
26
27 return v;
28
29 },
30
31 multiplyVector3Array: function ( a ) {
32
33 var tmp = THREE.Matrix3.__v1;
34
35 for ( var i = 0, il = a.length; i < il; i += 3 ) {
36
37 tmp.x = a[ i ];
38 tmp.y = a[ i + 1 ];
39 tmp.z = a[ i + 2 ];
40
41 this.multiplyVector3( tmp );
42
43 a[ i ] = tmp.x;
44 a[ i + 1 ] = tmp.y;
45 a[ i + 2 ] = tmp.z;
46
47 }
48
49 return a;
50
51 },
52
53 getInverse: function ( matrix ) {
54
55 // input: THREE.Matrix4
56 // ( based on http://code.google.com/p/webgl-mjs/ )
57
58 var me = matrix.elements;
59
60 var a11 = me[10] * me[5] - me[6] * me[9];
61 var a21 = - me[10] * me[1] + me[2] * me[9];
62 var a31 = me[6] * me[1] - me[2] * me[5];
63 var a12 = - me[10] * me[4] + me[6] * me[8];
64 var a22 = me[10] * me[0] - me[2] * me[8];
65 var a32 = - me[6] * me[0] + me[2] * me[4];
66 var a13 = me[9] * me[4] - me[5] * me[8];
67 var a23 = - me[9] * me[0] + me[1] * me[8];
68 var a33 = me[5] * me[0] - me[1] * me[4];
69
70 var det = me[0] * a11 + me[1] * a12 + me[2] * a13;
71
72 // no inverse
73
74 if ( det === 0 ) {
75
76 console.warn( "Matrix3.getInverse(): determinant == 0" );
77
78 }
79
80 var idet = 1.0 / det;
81
82 var m = this.elements;
83
84 m[ 0 ] = idet * a11; m[ 1 ] = idet * a21; m[ 2 ] = idet * a31;
85 m[ 3 ] = idet * a12; m[ 4 ] = idet * a22; m[ 5 ] = idet * a32;
86 m[ 6 ] = idet * a13; m[ 7 ] = idet * a23; m[ 8 ] = idet * a33;
87
88 return this;
89
90 },
91
92
93 transpose: function () {
94
95 var tmp, m = this.elements;
96
97 tmp = m[1]; m[1] = m[3]; m[3] = tmp;
98 tmp = m[2]; m[2] = m[6]; m[6] = tmp;
99 tmp = m[5]; m[5] = m[7]; m[7] = tmp;
100
101 return this;
102
103 },
104
105
106 transposeIntoArray: function ( r ) {
107
108 var m = this.m;
109
110 r[ 0 ] = m[ 0 ];
111 r[ 1 ] = m[ 3 ];
112 r[ 2 ] = m[ 6 ];
113 r[ 3 ] = m[ 1 ];
114 r[ 4 ] = m[ 4 ];
115 r[ 5 ] = m[ 7 ];
116 r[ 6 ] = m[ 2 ];
117 r[ 7 ] = m[ 5 ];
118 r[ 8 ] = m[ 8 ];
119
120 return this;
121
122 }
123
124 };
125
126 THREE.Matrix3.__v1 = new THREE.Vector3();
nike free rn
new balance hombre baratas
cinturones gucci
ugg rebajas
cinturon gucci
ray ban baratas
nike cortez
peuterey mujer
christian louboutin madrid
mbt zapatos
gafas ray ban baratas
mbt ofertas
air max blancas
mbt barcelona
nike air max 90
woolrich barcelona
nike mujer
botas ugg
gafas de sol carrera aratas
air max 2016 baratas
oakley baratas
nike air max 2016