public void Vec3MatrixMatrixMultTest1() { Vec3Matrix M1 = new Vec3Matrix(2, 2); M1[0, 0] = new Vec3(1, 1, 1); M1[0, 1] = new Vec3(0, 0, 0); M1[1, 0] = new Vec3(0, 0, 0); M1[1, 1] = new Vec3(1, 1, 1); Vec3Matrix M2 = new Vec3Matrix(2, 2); M2[0, 0] = new Vec3(1, 2, 3); M2[0, 1] = new Vec3(3, 2, 1); M2[1, 0] = new Vec3(1, 2, 3); M2[1, 1] = new Vec3(3, 2, 1); Vec3Matrix M3 = M1 * M2; Assert.AreEqual(M2, M3); }
public void Vec3MatrixVectorMultTest1() { Vec3Matrix M = new Vec3Matrix(2, 2); M[0, 0] = new Vec3(1, 1, 1); M[0, 1] = new Vec3(0, 0, 0); M[1, 0] = new Vec3(0, 0, 0); M[1, 1] = new Vec3(1, 1, 1); Vec3Vector v = new Vec3Vector(2); v[0] = new Vec3(1, 1, 1); v[1] = new Vec3(2, 2, 2); Vec3Vector nv = M * v; Console.Write("v(" + v[0] + v[1] + ") nv(" + nv[0] + nv[1] + ")"); Assert.AreEqual(v, nv); }
public void Vec3MatrixTransposeTest1() { Vec3Matrix M = new Vec3Matrix(2, 2); M[0, 0] = new Vec3(1, 1, 1); M[0, 1] = new Vec3(1, 2, 1); M[1, 0] = new Vec3(2, 1, 2); M[1, 1] = new Vec3(1, 1, 1); Vec3Matrix C = new Vec3Matrix(2, 2); C[0, 0] = new Vec3(1, 1, 1); C[0, 1] = new Vec3(2, 1, 2); C[1, 0] = new Vec3(1, 2, 1); C[1, 1] = new Vec3(1, 1, 1); Vec3Matrix T = M.Transpose; Console.Write("C(" + C + ") T(" + T + ")"); Assert.AreEqual(C, T); }