Skip to content

Commit 603483e

Browse files
committed
Merge branch 'master' of https://github.com/photonstorm/phaser
2 parents 7d692bc + e6d1df5 commit 603483e

32 files changed

Lines changed: 168 additions & 162 deletions

File tree

src/math/Matrix3.js

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,25 @@ var Class = require('../utils/Class');
1111

1212
/**
1313
* @classdesc
14-
* [description]
14+
* A three-dimensional matrix.
15+
*
16+
* Defaults to the identity matrix when instantiated.
1517
*
1618
* @class Matrix3
1719
* @memberOf Phaser.Math
1820
* @constructor
1921
* @since 3.0.0
2022
*
21-
* @param {Phaser.Math.Matrix3} [m] - [description]
23+
* @param {Phaser.Math.Matrix3} [m] - Optional Matrix3 to copy values from.
2224
*/
23-
2425
var Matrix3 = new Class({
2526

2627
initialize:
2728

2829
function Matrix3 (m)
2930
{
3031
/**
31-
* [description]
32+
* The matrix values.
3233
*
3334
* @name Phaser.Math.Matrix3#val
3435
* @type {Float32Array}
@@ -49,42 +50,42 @@ var Matrix3 = new Class({
4950
},
5051

5152
/**
52-
* [description]
53+
* Make a clone of this Matrix3.
5354
*
5455
* @method Phaser.Math.Matrix3#clone
5556
* @since 3.0.0
5657
*
57-
* @return {Phaser.Math.Matrix3} A new Matrix3 object.
58+
* @return {Phaser.Math.Matrix3} A clone of this Matrix3.
5859
*/
5960
clone: function ()
6061
{
6162
return new Matrix3(this);
6263
},
6364

6465
/**
65-
* [description]
66+
* This method is an alias for `Matrix3.copy`.
6667
*
6768
* @method Phaser.Math.Matrix3#set
6869
* @since 3.0.0
6970
*
70-
* @param {Phaser.Math.Matrix3} src - [description]
71+
* @param {Phaser.Math.Matrix3} src - The Matrix to set the values of this Matrix's from.
7172
*
72-
* @return {Phaser.Math.Matrix3} This Matrix3 object.
73+
* @return {Phaser.Math.Matrix3} This Matrix3.
7374
*/
7475
set: function (src)
7576
{
7677
return this.copy(src);
7778
},
7879

7980
/**
80-
* [description]
81+
* Copy the values of a given Matrix into this Matrix.
8182
*
8283
* @method Phaser.Math.Matrix3#copy
8384
* @since 3.0.0
8485
*
85-
* @param {Phaser.Math.Matrix3} src - [description]
86+
* @param {Phaser.Math.Matrix3} src - The Matrix to copy the values from.
8687
*
87-
* @return {Phaser.Math.Matrix3} This Matrix3 object.
88+
* @return {Phaser.Math.Matrix3} This Matrix3.
8889
*/
8990
copy: function (src)
9091
{
@@ -105,14 +106,14 @@ var Matrix3 = new Class({
105106
},
106107

107108
/**
108-
* [description]
109+
* Copy the values of a given Matrix4 into this Matrix3.
109110
*
110111
* @method Phaser.Math.Matrix3#fromMat4
111112
* @since 3.0.0
112113
*
113-
* @param {Phaser.Math.Matrix4} m - [description]
114+
* @param {Phaser.Math.Matrix4} m - The Matrix4 to copy the values from.
114115
*
115-
* @return {Phaser.Math.Matrix3} This Matrix3 object.
116+
* @return {Phaser.Math.Matrix3} This Matrix3.
116117
*/
117118
fromMat4: function (m)
118119
{
@@ -133,14 +134,14 @@ var Matrix3 = new Class({
133134
},
134135

135136
/**
136-
* [description]
137+
* Set the values of this Matrix from the given array.
137138
*
138139
* @method Phaser.Math.Matrix3#fromArray
139140
* @since 3.0.0
140141
*
141-
* @param {array} a - [description]
142+
* @param {array} a - The array to copy the values from.
142143
*
143-
* @return {Phaser.Math.Matrix3} This Matrix3 object.
144+
* @return {Phaser.Math.Matrix3} This Matrix3.
144145
*/
145146
fromArray: function (a)
146147
{
@@ -160,12 +161,12 @@ var Matrix3 = new Class({
160161
},
161162

162163
/**
163-
* [description]
164+
* Reset this Matrix to an identity (default) matrix.
164165
*
165166
* @method Phaser.Math.Matrix3#identity
166167
* @since 3.0.0
167168
*
168-
* @return {Phaser.Math.Matrix3} This Matrix3 object.
169+
* @return {Phaser.Math.Matrix3} This Matrix3.
169170
*/
170171
identity: function ()
171172
{
@@ -185,12 +186,12 @@ var Matrix3 = new Class({
185186
},
186187

187188
/**
188-
* [description]
189+
* Transpose this Matrix.
189190
*
190191
* @method Phaser.Math.Matrix3#transpose
191192
* @since 3.0.0
192193
*
193-
* @return {Phaser.Math.Matrix3} This Matrix3 object.
194+
* @return {Phaser.Math.Matrix3} This Matrix3.
194195
*/
195196
transpose: function ()
196197
{
@@ -210,12 +211,12 @@ var Matrix3 = new Class({
210211
},
211212

212213
/**
213-
* [description]
214+
* Invert this Matrix.
214215
*
215216
* @method Phaser.Math.Matrix3#invert
216217
* @since 3.0.0
217218
*
218-
* @return {Phaser.Math.Matrix3} This Matrix3 object.
219+
* @return {Phaser.Math.Matrix3} This Matrix3.
219220
*/
220221
invert: function ()
221222
{
@@ -264,7 +265,7 @@ var Matrix3 = new Class({
264265
* @method Phaser.Math.Matrix3#adjoint
265266
* @since 3.0.0
266267
*
267-
* @return {Phaser.Math.Matrix3} This Matrix3 object.
268+
* @return {Phaser.Math.Matrix3} This Matrix3.
268269
*/
269270
adjoint: function ()
270271
{
@@ -294,12 +295,12 @@ var Matrix3 = new Class({
294295
},
295296

296297
/**
297-
* [description]
298+
* Calculate the determinant of this Matrix.
298299
*
299300
* @method Phaser.Math.Matrix3#determinant
300301
* @since 3.0.0
301302
*
302-
* @return {number} [description]
303+
* @return {number} The determinant of this Matrix.
303304
*/
304305
determinant: function ()
305306
{
@@ -319,14 +320,14 @@ var Matrix3 = new Class({
319320
},
320321

321322
/**
322-
* [description]
323+
* Multiply this Matrix by the given Matrix.
323324
*
324325
* @method Phaser.Math.Matrix3#multiply
325326
* @since 3.0.0
326327
*
327-
* @param {Phaser.Math.Matrix3} src - [description]
328+
* @param {Phaser.Math.Matrix3} src - The Matrix to multiply this Matrix by.
328329
*
329-
* @return {Phaser.Math.Matrix3} This Matrix3 object.
330+
* @return {Phaser.Math.Matrix3} This Matrix3.
330331
*/
331332
multiply: function (src)
332333
{
@@ -370,14 +371,14 @@ var Matrix3 = new Class({
370371
},
371372

372373
/**
373-
* [description]
374+
* Translate this Matrix using the given Vector.
374375
*
375376
* @method Phaser.Math.Matrix3#translate
376377
* @since 3.0.0
377378
*
378-
* @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - [description]
379+
* @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with.
379380
*
380-
* @return {Phaser.Math.Matrix3} This Matrix3 object.
381+
* @return {Phaser.Math.Matrix3} This Matrix3.
381382
*/
382383
translate: function (v)
383384
{
@@ -393,14 +394,14 @@ var Matrix3 = new Class({
393394
},
394395

395396
/**
396-
* [description]
397+
* Apply a rotation transformation to this Matrix.
397398
*
398399
* @method Phaser.Math.Matrix3#rotate
399400
* @since 3.0.0
400401
*
401-
* @param {number} rad - [description]
402+
* @param {number} rad - The angle in radians to rotate by.
402403
*
403-
* @return {Phaser.Math.Matrix3} This Matrix3 object.
404+
* @return {Phaser.Math.Matrix3} This Matrix3.
404405
*/
405406
rotate: function (rad)
406407
{
@@ -428,14 +429,16 @@ var Matrix3 = new Class({
428429
},
429430

430431
/**
431-
* [description]
432+
* Apply a scale transformation to this Matrix.
433+
*
434+
* Uses the `x` and `y` components of the given Vector to scale the Matrix.
432435
*
433436
* @method Phaser.Math.Matrix3#scale
434437
* @since 3.0.0
435438
*
436-
* @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - [description]
439+
* @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with.
437440
*
438-
* @return {Phaser.Math.Matrix3} This Matrix3 object.
441+
* @return {Phaser.Math.Matrix3} This Matrix3.
439442
*/
440443
scale: function (v)
441444
{
@@ -455,14 +458,14 @@ var Matrix3 = new Class({
455458
},
456459

457460
/**
458-
* [description]
461+
* Set the values of this Matrix from the given Quaternion.
459462
*
460463
* @method Phaser.Math.Matrix3#fromQuat
461464
* @since 3.0.0
462465
*
463-
* @param {Phaser.Math.Quaternion} q - [description]
466+
* @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from.
464467
*
465-
* @return {Phaser.Math.Matrix3} This Matrix3 object.
468+
* @return {Phaser.Math.Matrix3} This Matrix3.
466469
*/
467470
fromQuat: function (q)
468471
{
@@ -512,7 +515,7 @@ var Matrix3 = new Class({
512515
*
513516
* @param {Phaser.Math.Matrix4} m - [description]
514517
*
515-
* @return {Phaser.Math.Matrix3} This Matrix3 object.
518+
* @return {Phaser.Math.Matrix3} This Matrix3.
516519
*/
517520
normalFromMat4: function (m)
518521
{

0 commit comments

Comments
 (0)