Skip to content

Commit

Permalink
Update Matrix4x4Tests.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
hez2010 committed Nov 22, 2024
1 parent c8caa3b commit 4771080
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions src/libraries/System.Numerics.Vectors/tests/Matrix4x4Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,7 @@ public void Matrix4x4CreateReflectionTest01()
float d = Vector3.Dot(v, plane.Normal);
Vector3 vp = point - 2.0f * d * plane.Normal;

AssertExtensions.Equal(vp.X, rp.X, 0.0f);
AssertExtensions.Equal(vp.Y, rp.Y, 0.0f);
AssertExtensions.Equal(vp.Z, rp.Z, 0.0f);
Assert.True(MathHelper.Equal(rp, vp), "Matrix4x4.CreateReflection did not provide expected value.");
}
}
}
Expand All @@ -833,25 +831,28 @@ public void Matrix4x4CreateReflectionTest02()
Plane plane = new Plane(0, 1, 0, 60);
Matrix4x4 actual = Matrix4x4.CreateReflection(plane);

AssertExtensions.Equal(1.0f, actual.M11, 0.0f);
AssertExtensions.Equal(0.0f, actual.M12, 0.0f);
AssertExtensions.Equal(0.0f, actual.M13, 0.0f);
AssertExtensions.Equal(0.0f, actual.M14, 0.0f);

AssertExtensions.Equal(0.0f, actual.M21, 0.0f);
AssertExtensions.Equal(-1.0f, actual.M22, 0.0f);
AssertExtensions.Equal(0.0f, actual.M23, 0.0f);
AssertExtensions.Equal(0.0f, actual.M24, 0.0f);

AssertExtensions.Equal(0.0f, actual.M31, 0.0f);
AssertExtensions.Equal(0.0f, actual.M32, 0.0f);
AssertExtensions.Equal(1.0f, actual.M33, 0.0f);
AssertExtensions.Equal(0.0f, actual.M34, 0.0f);

AssertExtensions.Equal(-0.0f, actual.M41, 0.0f);
AssertExtensions.Equal(-120.0f, actual.M42, 0.0f);
AssertExtensions.Equal(-0.0f, actual.M43, 0.0f);
AssertExtensions.Equal(1.0f, actual.M44, 0.0f);
Matrix4x4 expected = new Matrix4x4();
expected.M11 = 1.0f;
expected.M12 = 0.0f;
expected.M13 = 0.0f;
expected.M14 = 0.0f;

expected.M21 = 0.0f;
expected.M22 = -1.0f;
expected.M23 = 0.0f;
expected.M24 = 0.0f;

expected.M31 = 0.0f;
expected.M32 = 0.0f;
expected.M33 = 1.0f;
expected.M34 = 0.0f;

expected.M41 = 0.0f;
expected.M42 = -120.0f;
expected.M43 = 0.0f;
expected.M44 = 1.0f;

Assert.True(MathHelper.Equal(expected, actual), "Matrix4x4.CreateReflection did not return the expected value.");
}

// A test for CreateRotationZ (float)
Expand Down

0 comments on commit 4771080

Please sign in to comment.