Exemplo n.º 1
0
        protected override Intersection[] GetBaseIntersections(Ray ray)
        {
            var leftIntersections  = left.GetIntersections(ray);
            var rightIntersections = right.GetIntersections(ray);
            var allIntersections   = SharedUtils.JoinArrays(leftIntersections, rightIntersections);

            if (allIntersections == null)
            {
                return(null);
            }

            Array.Sort(allIntersections, (a, b) =>
            {
                if (a.t != b.t)
                {
                    return(Comparer <double> .Default.Compare(a.t, b.t));
                }

                return(Comparer <IFigure> .Default.Compare(a.figure, b.figure));
            });

            return(FilterIntersections(allIntersections));
        }
 protected override Intersection[] GetBaseIntersections(Ray ray)
 {
     return(SharedUtils.JoinArrays(GetConeIntersections(ray), GetCapsIntersections(ray)));
 }