// [ i j k l ] [ z ]
// [ 0 0 0 1 ] [ 1 ]
//
- public final float a, b, c, d, e, f, g, h, i, j, k, l;
+ public final float a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p;
public Matrix() { this(1); }
public Matrix(float scale) {
a = f = k = scale;
l = h = d = e = b = i = c = j = g = 0;
+ m = n = o = 0;
+ p = 1;
}
public Matrix(float scalex, float scaley, float scalez) {
a = scalex;
f = scaley;
k = scalez;
l = h = d = e = b = i = c = j = g = 0;
+ m = n = o = 0;
+ p = 1;
}
public Matrix(Vec translate) {
d = translate.x; h = translate.y; l = translate.z;
a = f = k = 1;
b = c = e = g = i = j = 0;
+ m = n = o = 0;
+ p = 1;
}
- public Matrix(float a, float b, float c, float d, float e, float f, float g, float h, float i, float j, float k, float l) {
+ public Matrix(float a, float b, float c, float d, float e, float f, float g,
+ float h, float i, float j, float k, float l, float m, float n, float o, float p) {
this.a = a; this.b = b; this.c = c; this.d = d; this.e = e; this.f = f; this.g = g; this.h = h; this.i = i;
- this.j = j; this.k = k; this.l = l;
+ this.j = j; this.k = k; this.l = l; this.m = m; this.n = n; this.o = o; this.p = p;
}
public Matrix times(float x) {
- return new Matrix(a*x, b*x, c*x, d*x, e*x, f*x, g*x, h*x, i*x, j*x, k*x, l*x);
+ return new Matrix(a*x, b*x, c*x, d*x, e*x, f*x, g*x, h*x, i*x, j*x, k*x, l*x, m*x, n*x, o*x, p*x);
}
public Matrix(Vec axis, float angle) {
double q = Math.cos(angle);
j = (float)(tmp1 + tmp2);
g = (float)(tmp1 - tmp2);
d = h = l = 0;
+ m = n = o = 0;
+ p = 1;
}
public Point times(Point p) {
+ // discards bottom row
return new Point(a*p.x + b*p.y + c*p.z + d,
e*p.x + f*p.y + g*p.z + h,
i*p.x + j*p.y + k*p.z + l);