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

Class Mat2

src/main/java/field/linalg/Mat2.java:46–1461  ·  view source on GitHub ↗

Contains the definition of a 2x2 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 m01 m11 @author Marc Downie (edited extensively from JOML project)

Source from the content-addressed store, hash-verified

44 * @author Marc Downie (edited extensively from JOML project)
45 */
46public class Mat2 implements Externalizable, Supplier<Mat2>, Mutable, Serializable_safe {
47
48 private static final long serialVersionUID = 1L;
49
50 public double m00, m10;
51 public double m01, m11;
52
53 /**
54 * Create a new {@link Mat2} and initialize it to {@link #identity() identity}.
55 */
56 public Mat2() {
57 super();
58 identity();
59 }
60
61 /**
62 * Create a new {@link Mat2} and initialize it with the values from the given matrix.
63 *
64 * @param mat the matrix to initialize this matrix with
65 */
66 public Mat2(Mat2 mat) {
67 m00 = mat.m00;
68 m01 = mat.m01;
69 m10 = mat.m10;
70 m11 = mat.m11;
71 }
72
73 /**
74 * Create a new {@link Mat2} and make it a copy of the upper left 3x3 of the given {@link Mat4}.
75 *
76 * @param mat the {@link Mat4} to copy the values from
77 */
78 public Mat2(Mat4 mat) {
79 m00 = mat.m00;
80 m01 = mat.m01;
81 m10 = mat.m10;
82 m11 = mat.m11;
83 }
84
85 /**
86 * Create a new {@link Mat2} and initialize its elements with the given values.
87 *
88 * @param m00 the value of m00
89 * @param m01 the value of m01
90 * @param m10 the value of m10
91 * @param m11 the value of m11
92 */
93 public Mat2(double m00, double m01, double m10, double m11) {
94 this.m00 = m00;
95 this.m01 = m01;
96 this.m10 = m10;
97 this.m11 = m11;
98 }
99
100 /**
101 * Set the values in this matrix to the ones in m.
102 *
103 * @param m the matrix whose values will be copied

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected