Exemplo n.º 1
0
        public void InverseTest_WhenRandomFramesAreGenerated_ThenFramesMultipliedWithThereInverseAreIdentity()
        {
            var helper   = new CreateRandomMatrixHelper();
            var matrices = Enumerable.Range(0, 100).Select(x => helper.CreateFrame()).ToList();

            var inverses = matrices.Select(x => x.Inverse()).ToList();
            var results  = matrices.Select(x => x * x.Inverse()).ToList();

            const double epsilon = 0.001;

            Assert.True(results.All(x => x.Equals(Matrix44D.Identity, epsilon)));
        }
Exemplo n.º 2
0
        public void InverseTest_WhenRandomFramesAreGenerated_ThenInverseMultipliedWithThereFramesAreIdentity()
        {
            var helper   = new CreateRandomMatrixHelper();
            var matrices = Enumerable.Range(0, 1000).Select(x => helper.CreateFrame()).ToList();

            var results = matrices.Select(x => x.Inverse() * x).ToList();

            foreach (var res in matrices)
            {
                var ident = (res * res.Inverse());
                if (ident != Matrix44D.Identity)
                {
                    var a = 0;
                    a++;
                }
            }

            const double epsilon = 0.001;

            Assert.True(results.All(x => x.Equals(Matrix44D.Identity, epsilon)));
        }