public override CollisionInfo calculateCollision(Ray ray)
        {
            List <double> col1 = s1.calculateCollision(ray);
            List <double> col2 = s2.calculateCollision(ray);

            if (col1.Count == 0 || col2.Count == 0)
            {
                return(noCollision());
            }

            if (col1[1] < col2[0] || col2[1] < col1[0])
            {
                return(noCollision());
            }

            double t = Math.Max(col1[0], col2[0]);

            if (t > 0)
            {
                Vector3 hitPosition = ray.Origin + t * ray.Direction;
                Vector3 normal      = s1.isOnSurface(hitPosition) ? s1.calculateNormal(hitPosition) : s2.calculateNormal(hitPosition);
                return(makeCollision(hitPosition, normal));
            }

            return(noCollision());
        }
        public override CollisionInfo calculateCollision(Ray ray)
        {
            List <double> col1 = s1.calculateCollision(ray);
            List <double> col2 = s2.calculateCollision(ray);

            if (col1.Count == 0)
            {
                return(noCollision());
            }

            double t = double.MinValue;

            if (col2.Count == 0)
            {
                t = col1[0];
            }
            else
            {
                if (col1[0] > 0 && (col1[0] < col2[0] || col1[0] > col2[1]))
                {
                    t = col1[0];
                }
                else if (col2[1] > 0 && col2[1] > col1[0] && col2[1] < col1[1])
                {
                    t = col2[1];
                }
            }

            if (t > 0)
            {
                Vector3 hitPosition = ray.Origin + t * ray.Direction;
                Vector3 normal      = s1.isOnSurface(hitPosition) ? s1.calculateNormal(hitPosition) : s2.calculateNormal(hitPosition);
                return(makeCollision(hitPosition, normal));
            }

            return(noCollision());
        }