Exemple #1
0
        /// <summary>
        /// Test if a sphere intersects at least one plane in in the frustum.
        /// </summary>
        /// <returns>true when the sphere intersects.</returns>
        internal bool IntersectsOne(BoundingSphere c)
        {
            foreach (Plane2d p in this.planes)
             {
            double distancePlaneToPoint = p.A * c.Center.X + p.B * c.Center.Y + p.C * c.Center.Z + p.D;
            if (distancePlaneToPoint * distancePlaneToPoint > -c.RadiusSq)
               // 1 radius inside the plane = outside
               return true;
             }

             //else it's in view
             return false;
        }
Exemple #2
0
		/// <summary>
		/// Test if a sphere intersects or is completely inside the frustum.
		/// </summary>
		/// <returns>true when the sphere intersects.</returns>
		public bool Intersects(BoundingSphere c)
		{
			foreach(Plane p in this.planes)
			{
				float distancePlaneToPoint = p.A * c.Center.X + p.B * c.Center.Y + p.C * c.Center.Z + p.D;
				if(distancePlaneToPoint < -c.Radius)
					// More than 1 radius outside the plane = outside
					return false;
			}

			//else it's in view
			return true;
		}