Namespace: DeltaEngine.Datatypes
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Tests.Datatypes.MatrixTests
4 unit tests call DeltaEngine.Datatypes.Matrix.Invert(DeltaEngine.Datatypes.Matrix)
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Parameters
- matrix
- Type: DeltaEngine.Datatypes Matrix
Return Value
Type: MatrixRemarks
Examples
[Test] public void Invert() { var expected1 = new Matrix(1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1); var expected2 = new Matrix(0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1); var expected3 = new Matrix(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); Assert.IsTrue(Matrix.Invert(Matrix.CreateRotationX(90.0f)).IsNearlyEqual(expected1)); Assert.IsTrue(Matrix.Invert(Matrix.CreateRotationY(90.0f)).IsNearlyEqual(expected2)); Assert.IsTrue(Matrix.Invert(Matrix.CreateRotationZ(90.0f)).IsNearlyEqual(expected3)); }
[Test] public void InvertTranspose() { var source = new Matrix(-4, 0, 0, 0, -1, 2, 0, 0, -4, 4, 4, 0, -1, -9, -1, 1); var expected1 = new Matrix(-0.25f, -0.125f, -0.125f, -1.5f, 0, 0.5f, -0.5f, 4, 0, 0, 0.25f, 0.25f, 0, 0, 0, 1); Assert.IsTrue(Matrix.InverseTranspose(source).IsNearlyEqual(expected1)); }
[Test] public void InvertingTwiceReturnsTheOriginal() { matrix = Matrix.CreateRotationY(60.0f); Assert.IsTrue(Matrix.Invert(Matrix.Invert(matrix)).IsNearlyEqual(matrix)); }
See Also