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))); }
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))); }