/// <summary>
        /// Checks whether the current BoundingFrustum intersects a BoundingSphere.
        /// </summary>
        /// <param name="sphere">The BoundingSphere to check for intersection with.</param><param name="result">[OutAttribute] true if the BoundingFrustum and BoundingSphere intersect; false otherwise.</param>
        public void Intersects(ref BoundingSphere sphere, out bool result)
        {
            if (this.gjk == null)
            {
                this.gjk = new Gjk();
            }
            this.gjk.Reset();
            Vector3 result1;

            Vector3.Subtract(ref this.cornerArray[0], ref sphere.Center, out result1);
            if ((double)result1.LengthSquared() < 9.99999974737875E-06)
            {
                result1 = Vector3.UnitX;
            }
            float num1 = float.MaxValue;

            result = false;
            float num2;

            do
            {
                Vector3 v;
                v.X = -result1.X;
                v.Y = -result1.Y;
                v.Z = -result1.Z;
                Vector3 result2;
                this.SupportMapping(ref v, out result2);
                Vector3 result3;
                sphere.SupportMapping(ref result1, out result3);
                Vector3 result4;
                Vector3.Subtract(ref result2, ref result3, out result4);
                if ((double)result1.X * (double)result4.X + (double)result1.Y * (double)result4.Y + (double)result1.Z * (double)result4.Z > 0.0)
                {
                    return;
                }
                this.gjk.AddSupportPoint(ref result4);
                result1 = this.gjk.ClosestPoint;
                float num3 = num1;
                num1 = result1.LengthSquared();
                if ((double)num3 - (double)num1 <= 9.99999974737875E-06 * (double)num3)
                {
                    return;
                }
                num2 = 4E-05f * this.gjk.MaxLengthSquared;
            }while (!this.gjk.FullSimplex && (double)num1 >= (double)num2);
            result = true;
        }
        public void Intersects(ref BoundingSphere sphere, out bool result)
        {
            Vector3 unitX;
            Vector3 vector2;
            Vector3 vector3;
            Vector3 vector4;
            Vector3 vector5;

            if (this.gjk == null)
            {
                this.gjk = new Gjk();
            }
            this.gjk.Reset();
            Vector3.Subtract(ref this.cornerArray[0], ref sphere.Center, out unitX);
            if (unitX.LengthSquared() < 9.99999974737875E-06)
            {
                unitX = Vector3.UnitX;
            }
            float maxValue = float.MaxValue;

            result = false;
Label_0059:
            vector2.X = -unitX.X;
            vector2.Y = -unitX.Y;
            vector2.Z = -unitX.Z;
            this.SupportMapping(ref vector2, out vector3);
            sphere.SupportMapping(ref unitX, out vector4);
            Vector3.Subtract(ref vector3, ref vector4, out vector5);
            if ((((unitX.X * vector5.X) + (unitX.Y * vector5.Y)) + (unitX.Z * vector5.Z)) <= 0.0)
            {
                this.gjk.AddSupportPoint(ref vector5);
                unitX = this.gjk.ClosestPoint;
                float num3 = maxValue;
                maxValue = unitX.LengthSquared();
                if ((num3 - maxValue) > (9.99999974737875E-06 * num3))
                {
                    float num2 = 4E-05f * this.gjk.MaxLengthSquared;
                    if (!this.gjk.FullSimplex && (maxValue >= num2))
                    {
                        goto Label_0059;
                    }
                    result = true;
                }
            }
        }