Exemple #1
0
 public void IsNotNearlyEqual()
 {
     var matrix1 = new Matrix(1, 0, 3, 0, 0, 2, 0, 4, 0, 3, 2, 0, 1, 0, 0, 2);
     Assert.IsFalse(matrix1.IsNearlyEqual(Matrix.Identity));
 }
Exemple #2
0
 public void RotateMatrix()
 {
     var matrix1 = new Matrix(1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1);
     var matrix2 = new Matrix(0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1);
     var matrix3 = new Matrix(0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
     var matrix4 = matrix1 * (matrix2 * matrix3);
     Assert.IsTrue(matrix1.IsNearlyEqual(Matrix.CreateRotationX(90)));
     Assert.IsTrue(matrix2.IsNearlyEqual(Matrix.CreateRotationY(90)));
     Assert.IsTrue(matrix3.IsNearlyEqual(Matrix.CreateRotationZ(90)));
     Assert.IsTrue(matrix4.IsNearlyEqual(Matrix.CreateRotationZYX(90, 90, 90)));
 }
Exemple #3
0
		public void CreateOrtographicProjectionMatrixwithNearAndFarPlanes()
		{
			var size = new Size(10, 5);
			matrix = Matrix.CreateOrthoProjection(size, 0.1f, 10.0f);
			var expected = new Matrix(0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.4f, 0.0f, 0.0f, 0.0f, 0.0f, -0.202f,
				0.0f, 0.0f, 0.0f, -1.0202f, 1.0f);
			Assert.IsTrue(expected.IsNearlyEqual(matrix));
		}