public void It_Returns_An_Point_Along_The_Ray(Vector expected, double amplitude) { // Arrange Ray ray = new Ray(new Point3(-10, 5, 10), new Vector3(20, 10, -5)); // Act Vector pointAlongTheRay = ray.OnRay(amplitude); // Assert pointAlongTheRay.Should().BeEquivalentTo(expected); }
public void It_Returns_A_Point_At_The_T_Parameter() { // Arrange Ray ray = new Ray(new Point3(0, 0, 0), new Vector3(-7, 10, -5)); var expectedPt = new Point3(-8.75, 12.5, -6.25); // Act var pt = ray.PointAt(1.25); // Assert pt.Should().BeEquivalentTo(expectedPt); }
public void It_Returns_The_Distance_To_A_Point() { // Arrange Ray ray = new Ray(new Point3(0, 0, 0), new Vector3(30, 45, 0)); var pt = new Point3(10, 20, 0); const double distanceExpected = 2.7735009811261464; // Act double distance = ray.DistanceTo(pt); // Assert distance.Should().Be(distanceExpected); }
public void It_Returns_The_Closest_Point() { // Arrange Ray ray = new Ray(new Point3(0, 0, 0), new Vector3(30, 45, 0)); var pt = new Point3(10, 20, 0); var expectedPt = new Point3(12.30769230769231, 18.461538461538463, 0); // Act var closestPt = ray.ClosestPoint(pt); // Assert closestPt.Should().BeEquivalentTo(expectedPt); }