private static void TestCase03() { // An intersection can encapsulate 'u' and 'v' Shape s = new Triangle(Tuple.Point(0, 1, 0), Tuple.Point(-1, 0, 0), Tuple.Point(1, 0, 0)); Intersection i = new IntersectionWithUV(3.5f, s, 0.2f, 0.4f); Assert.Equal(0.2f, i.U); Assert.Equal(0.4f, i.V); }
private static void TestCase05() { // A smooth triangle uses u/v to interpolate the normal Shape tri = ConstructSmoothTriangle(); Intersection i = new IntersectionWithUV(1, tri, 0.45f, 0.25f); Tuple n = tri.NormalAt(Tuple.Point(0, 0, 0), i); Assert.Equal(Tuple.Vector(-0.5547f, 0.83205f, 0), n); }
private static void TestCase06() { // Preparing the normal on smooth triangle Shape tri = ConstructSmoothTriangle(); Intersection i = new IntersectionWithUV(1, tri, 0.45f, 0.25f); Ray r = new Ray(Tuple.Point(-0.2f, 0.3f, -2), Tuple.Vector(0, 0, 1)); List <Intersection> xs = tri.Intersect(r); Computation comps = new Computation(i, r, xs); Assert.Equal(comps.Normalv, Tuple.Vector(-0.5547f, 0.83205f, 0)); }