public void ComputeNormalOnTranslatedShape() { var s = new TestShape() { Transform = Transform.Translate(0, 1, 0), }; var n = s.GetNormal(Vector4.CreatePosition(0, 1.70711, -0.70711)); var expected = Vector4.CreateDirection(0, 0.70711, -0.70711); const double eps = 0.00001; var comparer = Vector4.GetEqualityComparer(eps); Assert.Equal(expected, n, comparer); }
public void ComputeNormalOnTransformedShape() { var s = new TestShape() { Transform = Transform.Scale(1, 0.5, 1) * Transform.RotateZ(Math.PI / 5), }; var n = s.GetNormal(Vector4.CreatePosition(0, Math.Sqrt(2) / 2, -Math.Sqrt(2) / 2)); var expected = Vector4.CreateDirection(0, 0.97014, -0.24254); const double eps = 0.00001; var comparer = Vector4.GetEqualityComparer(eps); Assert.Equal(expected, n, comparer); }