Esempio n. 1
0
        public override void IntersectLocal(ref Tuple origin, ref Tuple direction, Intersections intersections)
        {
            Intersections leftXs = new Intersections();

            Left.Intersect(ref origin, ref direction, leftXs);
            var rightXs = new Intersections();

            Right.Intersect(ref origin, ref direction, rightXs);
            Intersections result;

            if (leftXs.Any() || rightXs.Any())
            {
                var xs = new Intersections(leftXs.Concat(rightXs));
                result = Filter(xs);
                intersections.AddRange(result);
            }
        }
Esempio n. 2
0
        public override Intersections IntersectLocal(Ray ray)
        {
            Intersections leftXs  = Left.Intersect(ray);
            var           rightXs = Right.Intersect(ray);
            Intersections result;

            if (leftXs.Any() || rightXs.Any())
            {
                var xs = new Intersections(leftXs.Concat(rightXs));
                result = Filter(xs);
            }
            else
            {
                result = new Intersections();
            }

            return(result);
        }