Exemplo n.º 1
0
        public void TestDeterminant()
        {
            var m = Matrix3D.GetIdentity();

            Assert.AreEqual(1, m.GetDeterminant());

            m.SetRow(0, 1, 0, 0);
            m.SetRow(1, 0, 1, 0);
            m.SetRow(2, 0, 5, 0);

            Assert.AreEqual(0, m.GetDeterminant());

            m = new Matrix3D(new float[, ]
            {
                { 1, 2, 3 },
                { 4, 5, 6 },
                { 7, 8, 9 }
            });

            Assert.AreEqual(1 * 5 * 9 + 2 * 6 * 7 + 3 * 4 * 8 - 7 * 5 * 3 - 8 * 6 * 1 - 9 * 2 * 4, m.GetDeterminant());
        }
Exemplo n.º 2
0
		public void TestDeterminant()
		{
			var m = Matrix3D.GetIdentity();

			Assert.AreEqual(1, m.GetDeterminant());

			m.SetRow(0, 1, 0, 0);
			m.SetRow(1, 0, 1, 0);
			m.SetRow(2, 0, 5, 0);

			Assert.AreEqual(0, m.GetDeterminant());

			m = new Matrix3D(new float[,]
			                 	{
			                 		{1, 2, 3},
			                 		{4, 5, 6},
			                 		{7, 8, 9}
			                 	});

			Assert.AreEqual(1*5*9 + 2*6*7 + 3*4*8 - 7*5*3 - 8*6*1 - 9*2*4, m.GetDeterminant());
		}