svnno****@sourc*****
svnno****@sourc*****
2009年 5月 27日 (水) 23:22:52 JST
Revision: 1189 http://svn.sourceforge.jp/view?root=sie&view=rev&rev=1189 Author: dhrname Date: 2009-05-27 23:22:52 +0900 (Wed, 27 May 2009) Log Message: ----------- Matrixオブジェクトの削除 Modified Paths: -------------- branches/05x/050/sie.js Modified: branches/05x/050/sie.js =================================================================== --- branches/05x/050/sie.js 2009-05-27 14:08:25 UTC (rev 1188) +++ branches/05x/050/sie.js 2009-05-27 14:22:52 UTC (rev 1189) @@ -1494,19 +1494,11 @@ return s; } -//SVGMatrixを参照。行列 -function Matrix(a,b,c,d,e,f) { //引数はすべてNumber型 - this.a = a; this.b = b; this.c = c; this.d = d; this.e = e; this.f = f; - return this; -} +//Matrixは2次元配列で処理 //Matrix同士の積を算出 -Matrix.prototype.multiply = function matrixmultiply( /*Matrix*/ m) { - var s = new Matrix(this.a * m.a + this.c * m.b,this.b * m.a + this.d * m.b,this.a * m.c + this.c * m.d,this.b * m.c + this.d * m.d,this.a * m.e + this.c * m.f + this.e,this.b * m.e + this.d * m.f + this.f); - return s; -} Array.prototype.multiply = function (m) { - var s = [[],[],[]]; - for (var i=0;i<3;++i) { + var s = [[],[],[0,0,1]]; + for (var i=0;i<2;++i) { var n = this[i]; for (var j=0;j<3;++j) { s[i][j] = m[0][j]*n[0] + m[1][j]*n[1] + m[2][j]*n[2]; @@ -1516,9 +1508,6 @@ } //行列式 -Matrix.prototype.determinant = function() { - return (this.a * this.d - this.b * this.c); -} Array.prototype.determinant = function () { return (this[0][0] * this[1][1] - this[1][0] * this[0][1]); }