Skip to content

Commit

Permalink
moving files around
Browse files Browse the repository at this point in the history
  • Loading branch information
shooshx committed Nov 23, 2012
1 parent dbd2103 commit 794a8ec
Show file tree
Hide file tree
Showing 73 changed files with 592 additions and 581 deletions.
File renamed without changes.
116 changes: 58 additions & 58 deletions glUtils.js → _old/glUtils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// augment Sylvester some
// augment Sylvester some
/*
Matrix.Translation = function (v)
{
Expand Down Expand Up @@ -63,34 +63,34 @@ Matrix.prototype.ensure4x4 = function()
this.elements.push([0, 0, 0, 1]);
}
return this;
};
Matrix.prototype.inverse3x3 = function() {
return this;
};
Matrix.prototype.inverse3x3 = function() {
if (this.elements.length != 3 || this.elements[0].length != 3)
return null;
var r = Matrix.Zero(3,3);
var A = this.elements;
var determinant = +A[0][0]*(A[1][1]*A[2][2]-A[2][1]*A[1][2])
-A[0][1]*(A[1][0]*A[2][2]-A[1][2]*A[2][0])
+A[0][2]*(A[1][0]*A[2][1]-A[1][1]*A[2][0]);
if (Math.abs(determinant) < 1e-20)
return null;
var invdet = 1/determinant;
r.elements[0][0] = (A[1][1] * A[2][2] - A[2][1] * A[1][2]) * invdet;
r.elements[1][0] = -(A[0][1] * A[2][2] - A[0][2] * A[2][1]) * invdet;
r.elements[2][0] = (A[0][1] * A[1][2] - A[0][2] * A[1][1]) * invdet;
r.elements[0][1] = -(A[1][0] * A[2][2] - A[1][2] * A[2][0]) * invdet;
r.elements[1][1] = (A[0][0] * A[2][2] - A[0][2] * A[2][0]) * invdet;
r.elements[2][1] = -(A[0][0] * A[1][2] - A[1][0] * A[0][2]) * invdet;
r.elements[0][2] = (A[1][0] * A[2][1] - A[2][0] * A[1][1]) * invdet;
r.elements[1][2] = -(A[0][0] * A[2][1] - A[2][0] * A[0][1]) * invdet;
r.elements[2][2] = (A[0][0] * A[1][1] - A[1][0] * A[0][1]) * invdet;
return r.transpose();
var r = Matrix.Zero(3,3);
var A = this.elements;
var determinant = +A[0][0]*(A[1][1]*A[2][2]-A[2][1]*A[1][2])
-A[0][1]*(A[1][0]*A[2][2]-A[1][2]*A[2][0])
+A[0][2]*(A[1][0]*A[2][1]-A[1][1]*A[2][0]);
if (Math.abs(determinant) < 1e-20)
return null;
var invdet = 1/determinant;
r.elements[0][0] = (A[1][1] * A[2][2] - A[2][1] * A[1][2]) * invdet;
r.elements[1][0] = -(A[0][1] * A[2][2] - A[0][2] * A[2][1]) * invdet;
r.elements[2][0] = (A[0][1] * A[1][2] - A[0][2] * A[1][1]) * invdet;
r.elements[0][1] = -(A[1][0] * A[2][2] - A[1][2] * A[2][0]) * invdet;
r.elements[1][1] = (A[0][0] * A[2][2] - A[0][2] * A[2][0]) * invdet;
r.elements[2][1] = -(A[0][0] * A[1][2] - A[1][0] * A[0][2]) * invdet;
r.elements[0][2] = (A[1][0] * A[2][1] - A[2][0] * A[1][1]) * invdet;
r.elements[1][2] = -(A[0][0] * A[2][1] - A[2][0] * A[0][1]) * invdet;
r.elements[2][2] = (A[0][0] * A[1][1] - A[1][0] * A[0][1]) * invdet;
return r.transpose();
}
Matrix.prototype.make3x3 = function()
Expand All @@ -106,13 +106,13 @@ Matrix.prototype.make3x3 = function()

Vector.prototype.flatten = function ()
{
return this.elements;
};
/*
Vector.prototype.lsquare3 = function()
{
return this.elements[0]*this.elements[0]+this.elements[1]*this.elements[1]+this.elements[2]*this.elements[2];
return this.elements;
};
/*
Vector.prototype.lsquare3 = function()
{
return this.elements[0]*this.elements[0]+this.elements[1]*this.elements[1]+this.elements[2]*this.elements[2];
}
function mht(m) {
var s = "";
Expand Down Expand Up @@ -156,27 +156,27 @@ function makeLookAt(ex, ey, ez,
[0, 1, 0, -ey],
[0, 0, 1, -ez],
[0, 0, 0, 1]]);
return m.x(t);
}
function makeLookAtv(eye, center, up) {
var mag;
var z = eye.subtract(center).toUnitVector();
var x = up.cross(z).toUnitVector();
var y = z.cross(x).toUnitVector();
var m = $M([[x.e(1), x.e(2), x.e(3), 0],
[y.e(1), y.e(2), y.e(3), 0],
[z.e(1), z.e(2), z.e(3), 0],
[0, 0, 0, 1]]);
var t = $M([[1, 0, 0, -eye.e(1)],
[0, 1, 0, -eye.e(2)],
[0, 0, 1, -eye.e(3)],
[0, 0, 0, 1]]);
return m.x(t);
//return m;
return m.x(t);
}
function makeLookAtv(eye, center, up) {
var mag;
var z = eye.subtract(center).toUnitVector();
var x = up.cross(z).toUnitVector();
var y = z.cross(x).toUnitVector();
var m = $M([[x.e(1), x.e(2), x.e(3), 0],
[y.e(1), y.e(2), y.e(3), 0],
[z.e(1), z.e(2), z.e(3), 0],
[0, 0, 0, 1]]);
var t = $M([[1, 0, 0, -eye.e(1)],
[0, 1, 0, -eye.e(2)],
[0, 0, 1, -eye.e(3)],
[0, 0, 0, 1]]);
return m.x(t);
//return m;
}
//
Expand Down Expand Up @@ -226,6 +226,6 @@ function makeOrtho(left, right, bottom, top, znear, zfar)
[0, 0, -2 / (zfar - znear), tz],
[0, 0, 0, 1]]);
}
*/

*/


File renamed without changes.
Loading

0 comments on commit 794a8ec

Please sign in to comment.