public void GetHit_WithPositiveAndNegativeDistances_ExpectCorrectIntersection_0() { //arrange var sphere = new Sphere(); var ray = new Ray(new Point3D(0, 0, 1), new Vector3D(0, 0, 1)); var intersection1 = new Intersection(-1, sphere, ray); var intersection2 = new Intersection(1, sphere, ray); var intersections = new Intersections( new List <Intersection>() { intersection1, intersection2 }); //act var hit = intersections.GetNearestHit(); //assert Assert.AreEqual(intersection2, hit); }
public void GetHit_WithNegativeDistances_ExpectNull() { //arrange var sphere = new Sphere(); var ray = new Ray(new Point3D(0, 0, 1), new Vector3D(0, 0, 1)); var intersection1 = new Intersection(-2, sphere, ray); var intersection2 = new Intersection(-1, sphere, ray); var intersections = new Intersections( new List <Intersection>() { intersection1, intersection2 }); //act var hit = intersections.GetNearestHit(); //assert Assert.AreEqual(Option <Intersection> .None, hit); }