public void RowConstructor() { var expected = GetTestMatrix(); var actual = new NMatrix4d(expected.Row0, expected.Row1, expected.Row2, expected.Row3); Asserts.AreEqual(expected, actual, "ctor 1"); }
public void ElementConstructor() { var expected = GetTestMatrix(); var actual = new NMatrix4d(expected.M11, expected.M12, expected.M13, expected.M14, expected.M21, expected.M22, expected.M23, expected.M24, expected.M31, expected.M32, expected.M33, expected.M34, expected.M41, expected.M42, expected.M43, expected.M44); Asserts.AreEqual(expected, actual, "ctor 1"); }
public void Multiply() { var inputL = GetTestMatrix(); var inputR = GetTestMatrix(); var inputSimdL = (NMatrix4d)inputL; var inputSimdR = (NMatrix4d)inputR; var expected = Matrix4d.Mult(inputL, inputR); var actual = NMatrix4d.Multiply(inputSimdL, inputSimdR); Asserts.AreEqual(expected, actual, "multiply"); }
public void Identity() { var identity = new NMatrix4d { M11 = 1d, M22 = 1d, M33 = 1d, M44 = 1d, }; Asserts.AreEqual(identity, NMatrix4d.Identity, "identity"); Asserts.AreEqual(Matrix4d.Identity, NMatrix4d.Identity, "opentk identity"); }
public void TransposeStatic_ByRef() { var input = GetTestMatrix(); var inputSimd = (NMatrix4d)input; Matrix4d expected; NMatrix4d actual; Matrix4d.Transpose(ref input, out expected); NMatrix4d.Transpose(ref inputSimd, out actual); Asserts.AreEqual(expected, actual, "transpose out/ref"); }
public void Multiply_ByRef() { var inputL = GetTestMatrix(); var inputR = GetTestMatrix(); var inputSimdL = (NMatrix4d)inputL; var inputSimdR = (NMatrix4d)inputR; Matrix4d expected; NMatrix4d actual; Matrix4d.Mult(ref inputL, ref inputR, out expected); NMatrix4d.Multiply(ref inputSimdL, ref inputSimdR, out actual); Asserts.AreEqual(expected, actual, "multiply"); }
public void TransposeStatic() { var input = GetTestMatrix(); var inputSimd = (NMatrix4d)input; var expected = Matrix4d.Transpose(input); var actual = NMatrix4d.Transpose(inputSimd); Asserts.AreEqual(expected, actual, "transpose"); input = GetTestMatrix(); inputSimd = (NMatrix4d)input; Matrix4d.Transpose(ref input, out expected); NMatrix4d.Transpose(ref inputSimd, out actual); Asserts.AreEqual(expected, actual, "transpose out/ref"); }
public static void AreEqual(NMatrix4d expected, Matrix4d actual, string message) { AreEqual(expected.M11, actual.M11, message + " (M11)"); AreEqual(expected.M21, actual.M21, message + " (M21)"); AreEqual(expected.M31, actual.M31, message + " (M31)"); AreEqual(expected.M41, actual.M41, message + " (M41)"); AreEqual(expected.M12, actual.M12, message + " (M12)"); AreEqual(expected.M22, actual.M22, message + " (M22)"); AreEqual(expected.M32, actual.M32, message + " (M32)"); AreEqual(expected.M42, actual.M42, message + " (M42)"); AreEqual(expected.M13, actual.M13, message + " (M13)"); AreEqual(expected.M23, actual.M23, message + " (M23)"); AreEqual(expected.M33, actual.M33, message + " (M33)"); AreEqual(expected.M43, actual.M43, message + " (M43)"); AreEqual(expected.M14, actual.M14, message + " (M14)"); AreEqual(expected.M24, actual.M24, message + " (M24)"); AreEqual(expected.M34, actual.M34, message + " (M34)"); AreEqual(expected.M44, actual.M44, message + " (M44)"); }
public static void AreEqual(NMatrix4d expected, Matrix4d actual, string message) { AreEqual(expected.M11, actual.M11, $"{message} (M11) expected: {expected} actual: {actual}"); AreEqual(expected.M21, actual.M21, $"{message} (M21) expected: {expected} actual: {actual}"); AreEqual(expected.M31, actual.M31, $"{message} (M31) expected: {expected} actual: {actual}"); AreEqual(expected.M41, actual.M41, $"{message} (M41) expected: {expected} actual: {actual}"); AreEqual(expected.M12, actual.M12, $"{message} (M12) expected: {expected} actual: {actual}"); AreEqual(expected.M22, actual.M22, $"{message} (M22) expected: {expected} actual: {actual}"); AreEqual(expected.M32, actual.M32, $"{message} (M32) expected: {expected} actual: {actual}"); AreEqual(expected.M42, actual.M42, $"{message} (M42) expected: {expected} actual: {actual}"); AreEqual(expected.M13, actual.M13, $"{message} (M13) expected: {expected} actual: {actual}"); AreEqual(expected.M23, actual.M23, $"{message} (M23) expected: {expected} actual: {actual}"); AreEqual(expected.M33, actual.M33, $"{message} (M33) expected: {expected} actual: {actual}"); AreEqual(expected.M43, actual.M43, $"{message} (M43) expected: {expected} actual: {actual}"); AreEqual(expected.M14, actual.M14, $"{message} (M14) expected: {expected} actual: {actual}"); AreEqual(expected.M24, actual.M24, $"{message} (M24) expected: {expected} actual: {actual}"); AreEqual(expected.M34, actual.M34, $"{message} (M34) expected: {expected} actual: {actual}"); AreEqual(expected.M44, actual.M44, $"{message} (M44) expected: {expected} actual: {actual}"); }