Example #1
0
        public void IntersectTestChildrenIfRayHitsBounds()
        {
            var l   = new TestGeometry();
            var r   = new TestGeometry();
            var s   = new ConstructiveSolid(ConstructiveOp.Difference, l, r);
            var ray = new Ray(new Point(0, 0, -5), new Vector(0, 0, 1));
            var xs  = s.Intersects(ray);

            // Child tested so SavedRay in not default.
            l.SavedRay.Should().NotBe(new Ray());
            r.SavedRay.Should().NotBe(new Ray());
        }
Example #2
0
        public void IntersectDoesNotTestChildrenIfRayMissesBounds()
        {
            var l   = new TestGeometry();
            var r   = new TestGeometry();
            var s   = new ConstructiveSolid(ConstructiveOp.Difference, l, r);
            var ray = new Ray(new Point(0, 0, -5), new Vector(0, 1, 0));
            var xs  = s.Intersects(ray);

            // Child not tested so SavedRay remains default.
            l.SavedRay.Should().Be(new Ray());
            r.SavedRay.Should().Be(new Ray());
        }