package edu.berkeley.qfat.geom;
-/** affine matrix; immutable */
+/** an affine matrix; immutable */
public class Matrix {
+ /**
+ * <pre>
+ * [ a b c d ] [ x ]
+ * [ e f g h ] [ y ]
+ * [ i j k l ] [ z ]
+ * [ m n o p ] [ 1 ]
+ * </pre>
+ */
+ public final float a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p;
+
public static final Matrix ZERO = new Matrix(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+ public static final Matrix ONE = new Matrix(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);
+
+ public static Matrix scale(float scale) { return new Matrix(scale, 0, 0, 0, 0, scale, 0, 0, 0, 0, scale, 0, 0, 0, 0, 1); }
- //
- // [ a b c d ] [ x ]
- // [ e f g h ] [ y ]
- // [ i j k l ] [ z ]
- // [ m n o p ] [ 1 ]
- //
- 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;