+
+ public Matrix plus(Matrix x) {
+ return new Matrix(a+x.a, b+x.b, c+x.c, d+x.d, e+x.e, f+x.f, g+x.g, h+x.h, i+x.i, j+x.j, k+x.k, l+x.l, m+x.m, n+x.n, o+x.o, p+x.p);
+ }
+ public Matrix minus(Matrix x) {
+ return new Matrix(a-x.a, b-x.b, c-x.c, d-x.d, e-x.e, f-x.f, g-x.g, h-x.h, i-x.i, j-x.j, k-x.k, l-x.l, m-x.m, n-x.n, o-x.o, p-x.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, m*x, n*x, o*x, p*x);
+ }
+
+ /** computes (v^T)(this)(v) */
+ public float preAndPostMultiply(Point point) {
+ float ret =
+ ((a*point.x + b*point.y + c*point.z + d) * point.x) +
+ ((e*point.x + f*point.y + g*point.z + h) * point.y) +
+ ((i*point.x + j*point.y + k*point.z + l) * point.z) +
+ ((m*point.x + n*point.y + o*point.z + p) * 1);
+ return ret;
+ }
+
+ /** discards bottom row */