MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / Mat3

Class Mat3

src/main/java/field/linalg/Mat3.java:47–1815  ·  view source on GitHub ↗

Contains the definition of a 3x3 Matrix of doubles, and associated functions to transform it. The matrix is column-major to match OpenGL's interpretation, and it looks like this: m00 m10 m20 m01 m11 m21 m02 m12 m22 @author Richard Greenlees @author Kai Burjack

Source from the content-addressed store, hash-verified

45 * @author Kai Burjack
46 */
47public class Mat3 implements Externalizable, Supplier<Mat3>, Mutable, Serializable_safe {
48
49 private static final long serialVersionUID = 1L;
50
51 public double m00, m10, m20;
52 public double m01, m11, m21;
53 public double m02, m12, m22;
54
55 /**
56 * Create a new {@link Mat3} and initialize it to {@link #identity() identity}.
57 */
58 public Mat3() {
59 super();
60 identity();
61 }
62
63 /**
64 * Create a new {@link Mat3} and initialize it with the values from the given matrix.
65 *
66 * @param mat the matrix to initialize this matrix with
67 */
68 public Mat3(Mat3 mat) {
69 m00 = mat.m00;
70 m01 = mat.m01;
71 m02 = mat.m02;
72 m10 = mat.m10;
73 m11 = mat.m11;
74 m12 = mat.m12;
75 m20 = mat.m20;
76 m21 = mat.m21;
77 m22 = mat.m22;
78 }
79
80 /**
81 * Create a new {@link Mat3} and make it a copy of the upper left 3x3 of the given {@link Mat4}.
82 *
83 * @param mat the {@link Mat4} to copy the values from
84 */
85 public Mat3(Mat4 mat) {
86 m00 = mat.m00;
87 m01 = mat.m01;
88 m02 = mat.m02;
89 m10 = mat.m10;
90 m11 = mat.m11;
91 m12 = mat.m12;
92 m20 = mat.m20;
93 m21 = mat.m21;
94 m22 = mat.m22;
95 }
96
97 /**
98 * Create a new {@link Mat3} and make it a copy of the given Mat2; the bottom right entry is given the value "m22"
99 *
100 * @param mat the {@link Mat2} to copy the values from
101 * @param m22 the bottom right value of the resulting Mat3
102 */
103 public Mat3(Mat2 mat, double m22) {
104 m00 = mat.m00;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected