29
29
window . Uint16Array = window . Uint16Array || window . Array ;
30
30
window . Float32Array = window . Float32Array || window . Array ;
31
31
( function ( cc ) {
32
+ /**
33
+ * <p>
34
+ * A 3x3 matrix </br>
35
+ * </p>
36
+ * @class
37
+ * @param {cc.math.Matrix3 } [mat3]
38
+ */
32
39
cc . math . Matrix3 = function ( mat3 ) {
33
40
if ( mat3 && mat3 . mat ) {
34
41
this . mat = new Float32Array ( mat3 . mat ) ;
@@ -37,9 +44,16 @@ window.Float32Array = window.Float32Array || window.Array;
37
44
}
38
45
} ;
39
46
cc . kmMat3 = cc . math . Matrix3 ;
40
- var proto = cc . math . Matrix3 . prototype ;
41
-
42
- proto . fill = function ( mat3 ) { //cc.kmMat3Fill
47
+ var _p = cc . math . Matrix3 . prototype ;
48
+
49
+ /**
50
+ * Copy matrix.
51
+ * @fn fill
52
+ * @memberof cc.math.Matrix3
53
+ * @param {cc.math.Matrix3 } mat3 Matrix to copy
54
+ * @return {cc.math.Matrix3 } this
55
+ */
56
+ _p . fill = function ( mat3 ) { //cc.kmMat3Fill
43
57
var mat = this . mat , matIn = mat3 . mat ;
44
58
mat [ 0 ] = matIn [ 0 ] ;
45
59
mat [ 1 ] = matIn [ 1 ] ;
@@ -53,7 +67,7 @@ window.Float32Array = window.Float32Array || window.Array;
53
67
return this ;
54
68
} ;
55
69
56
- proto . adjugate = function ( ) { //= cc.kmMat3Adjugate
70
+ _p . adjugate = function ( ) { //= cc.kmMat3Adjugate
57
71
var mat = this . mat ;
58
72
var m0 = mat [ 0 ] , m1 = mat [ 1 ] , m2 = mat [ 2 ] , m3 = mat [ 3 ] , m4 = mat [ 4 ] ,
59
73
m5 = mat [ 5 ] , m6 = mat [ 6 ] , m7 = mat [ 7 ] , m8 = mat [ 8 ] ;
@@ -71,7 +85,13 @@ window.Float32Array = window.Float32Array || window.Array;
71
85
return this ;
72
86
} ;
73
87
74
- proto . identity = function ( ) { //cc.kmMat3Identity
88
+ /**
89
+ * Sets pOut to an identity matrix returns pOut
90
+ * @memberof cc.math.Matrix3
91
+ * @param {cc.math.Matrix3 } pOut - A pointer to the matrix to set to identity
92
+ * @return {cc.math.Matrix3 } this
93
+ */
94
+ _p . identity = function ( ) { //cc.kmMat3Identity
75
95
var mat = this . mat ;
76
96
mat [ 1 ] = mat [ 2 ] = mat [ 3 ] =
77
97
mat [ 5 ] = mat [ 6 ] = mat [ 7 ] = 0 ;
@@ -81,7 +101,7 @@ window.Float32Array = window.Float32Array || window.Array;
81
101
82
102
var tmpMatrix = new cc . math . Matrix3 ( ) ; // internal matrix
83
103
84
- proto . inverse = function ( determinate ) { //cc.kmMat3Inverse
104
+ _p . inverse = function ( determinate ) { //cc.kmMat3Inverse
85
105
if ( determinate === 0.0 )
86
106
return this ;
87
107
tmpMatrix . assignFrom ( this ) ;
@@ -91,14 +111,14 @@ window.Float32Array = window.Float32Array || window.Array;
91
111
return this ;
92
112
} ;
93
113
94
- proto . isIdentity = function ( ) { //= cc.kmMat3IsIdentity
114
+ _p . isIdentity = function ( ) { //= cc.kmMat3IsIdentity
95
115
var mat = this . mat ;
96
116
return ( mat [ 0 ] === 1 && mat [ 1 ] === 0 && mat [ 2 ] === 0
97
117
&& mat [ 3 ] === 0 && mat [ 4 ] === 1 && mat [ 5 ] === 0
98
118
&& mat [ 6 ] === 0 && mat [ 7 ] === 0 && mat [ 8 ] === 1 ) ;
99
119
} ;
100
120
101
- proto . transpose = function ( ) { // cc.kmMat3Transpose
121
+ _p . transpose = function ( ) { // cc.kmMat3Transpose
102
122
var mat = this . mat ;
103
123
var m1 = mat [ 1 ] , m2 = mat [ 2 ] , m3 = mat [ 3 ] , m5 = mat [ 5 ] ,
104
124
m6 = mat [ 6 ] , m7 = mat [ 7 ] ;
@@ -115,7 +135,7 @@ window.Float32Array = window.Float32Array || window.Array;
115
135
return this ;
116
136
} ;
117
137
118
- proto . determinant = function ( ) {
138
+ _p . determinant = function ( ) {
119
139
var mat = this . mat ;
120
140
/*
121
141
calculating the determinant following the rule of sarus,
@@ -130,7 +150,7 @@ window.Float32Array = window.Float32Array || window.Array;
130
150
return output ;
131
151
} ;
132
152
133
- proto . multiply = function ( mat3 ) {
153
+ _p . multiply = function ( mat3 ) {
134
154
var m1 = this . mat , m2 = mat3 . mat ;
135
155
var a0 = m1 [ 0 ] , a1 = m1 [ 1 ] , a2 = m1 [ 2 ] , a3 = m1 [ 3 ] , a4 = m1 [ 4 ] , a5 = m1 [ 5 ] ,
136
156
a6 = m1 [ 6 ] , a7 = m1 [ 7 ] , a8 = m1 [ 8 ] ;
@@ -151,7 +171,7 @@ window.Float32Array = window.Float32Array || window.Array;
151
171
return this ;
152
172
} ;
153
173
154
- proto . multiplyScalar = function ( factor ) {
174
+ _p . multiplyScalar = function ( factor ) {
155
175
var mat = this . mat ;
156
176
mat [ 0 ] *= factor ;
157
177
mat [ 1 ] *= factor ;
@@ -185,7 +205,7 @@ window.Float32Array = window.Float32Array || window.Array;
185
205
return retMat ;
186
206
} ;
187
207
188
- proto . assignFrom = function ( matIn ) { // cc.kmMat3Assign
208
+ _p . assignFrom = function ( matIn ) { // cc.kmMat3Assign
189
209
if ( this === matIn ) {
190
210
cc . log ( "cc.math.Matrix3.assign(): current matrix equals matIn" ) ;
191
211
return this ;
@@ -203,7 +223,7 @@ window.Float32Array = window.Float32Array || window.Array;
203
223
return this ;
204
224
} ;
205
225
206
- proto . equals = function ( mat3 ) {
226
+ _p . equals = function ( mat3 ) {
207
227
if ( this === mat3 )
208
228
return true ;
209
229
var EPSILON = cc . math . EPSILON , m1 = this . mat , m2 = mat3 . mat ;
@@ -331,14 +351,7 @@ window.Float32Array = window.Float32Array || window.Array;
331
351
return ret ;
332
352
} ;
333
353
334
- proto . rotationToAxisAngle = function ( ) { //cc.kmMat3RotationToAxisAngle
354
+ _p . rotationToAxisAngle = function ( ) { //cc.kmMat3RotationToAxisAngle
335
355
return cc . math . Quaternion . rotationMatrix ( this ) . toAxisAndAngle ( ) ;
336
356
}
337
357
} ) ( cc ) ;
338
-
339
-
340
-
341
-
342
-
343
-
344
-
0 commit comments