Skip to content

Commit

Permalink
feat: add Matrix.copy & clone & set
Browse files Browse the repository at this point in the history
  • Loading branch information
06wj committed Aug 8, 2018
1 parent f45354b commit 304dac2
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/geom/Matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,50 @@ var Matrix = Class.create(/** @lends Matrix.prototype */{
this.ty = ty;
},

/**
* set
* @param {Number} a
* @param {Number} b
* @param {Number} c
* @param {Number} d
* @param {Number} tx
* @param {Number} ty
*/
set: function(a, b, c, d, tx, ty){
this.a = a;
this.b = b;
this.c = c;
this.d = d;
this.tx = tx;
this.ty = ty;

return this;
},

/**
* copy
* @param {Matrix} mat
* @return {Matrix} this
*/
copy: function(mat){
this.a = mat.a;
this.b = mat.b;
this.c = mat.c;
this.d = mat.d;
this.tx = mat.tx;
this.ty = mat.ty;

return this;
},

/**
* clone
* @return {Matrix}
*/
clone: function(){
return new Matrix().copy(this);
},

/**
* @language=en
* Link a Matrix to current Matrix, in order to make geometry effects on these two composed more effective.
Expand Down

0 comments on commit 304dac2

Please sign in to comment.