public void IntersectingConeWithRayParallelOneHalves() { var s = new shape.Cone(); var direction = pt.Vector(0, 1, 1).Normalize(); var r = new Ray(pt.Point(0, 0, -1), direction); var xs = s.Intersect(r); Assert.Single(xs); Assert.Equal(0.35355, xs[0].T, 5); }
public void IntersectConeRay(double pX, double pY, double pZ, double vX, double vY, double vZ, double t0, double t1) { var s = new shape.Cone(); var origin = pt.Point(pX, pY, pZ); var direction = pt.Vector(vX, vY, vZ).Normalize(); var ray = new Ray(origin, direction); var xs = s.Intersect(ray); Assert.Equal(2, xs.Length); Assert.Equal(t0, xs[0].T, 5); Assert.Equal(t1, xs[1].T, 5); }
public void IntersectConeEndCap(double pX, double pY, double pZ, double vX, double vY, double vZ, double count) { var s = new shape.Cone() { Minimum = -0.5, Maximum = 0.5, Closed = true }; var origin = pt.Point(pX, pY, pZ); var direction = pt.Vector(vX, vY, vZ).Normalize(); var ray = new Ray(origin, direction); var xs = s.Intersect(ray); Assert.Equal(count, xs.Length); }