Beispiel #1
0
        public static void Intersects(ref BoundingSphere3 boundingSphere, ref BoundingBox3 boundingBox, out bool result)
        {
            Vector3 clampedLocation;

            if (boundingSphere.Center.X > boundingBox.Max.X)
            {
                clampedLocation.X = boundingBox.Max.X;
            }
            else if (boundingSphere.Center.X < boundingBox.Min.X)
            {
                clampedLocation.X = boundingBox.Min.X;
            }
            else
            {
                clampedLocation.X = boundingSphere.Center.X;
            }

            if (boundingSphere.Center.Y > boundingBox.Max.Y)
            {
                clampedLocation.Y = boundingBox.Max.Y;
            }
            else if (boundingSphere.Center.Y < boundingBox.Min.Y)
            {
                clampedLocation.Y = boundingBox.Min.Y;
            }
            else
            {
                clampedLocation.Y = boundingSphere.Center.Y;
            }

            if (boundingSphere.Center.Z > boundingBox.Max.Z)
            {
                clampedLocation.Z = boundingBox.Max.Z;
            }
            else if (boundingSphere.Center.Z < boundingBox.Min.Z)
            {
                clampedLocation.Z = boundingBox.Min.Z;
            }
            else
            {
                clampedLocation.Z = boundingSphere.Center.Z;
            }

            result = clampedLocation.DistanceSquared(boundingSphere.Center) <= (boundingSphere.Radius * boundingSphere.Radius);
        }
Beispiel #2
0
        public bool Intersects(BoundingSphere3 boundingSphere)
        {
            Vector3 clampedLocation;

            if (boundingSphere.Center.X > Max.X)
            {
                clampedLocation.X = Max.X;
            }
            else if (boundingSphere.Center.X < Min.X)
            {
                clampedLocation.X = Min.X;
            }
            else
            {
                clampedLocation.X = boundingSphere.Center.X;
            }

            if (boundingSphere.Center.Y > Max.Y)
            {
                clampedLocation.Y = Max.Y;
            }
            else if (boundingSphere.Center.Y < Min.Y)
            {
                clampedLocation.Y = Min.Y;
            }
            else
            {
                clampedLocation.Y = boundingSphere.Center.Y;
            }

            if (boundingSphere.Center.Z > Max.Z)
            {
                clampedLocation.Z = Max.Z;
            }
            else if (boundingSphere.Center.Z < Min.Z)
            {
                clampedLocation.Z = Min.Z;
            }
            else
            {
                clampedLocation.Z = boundingSphere.Center.Z;
            }

            return(clampedLocation.DistanceSquared(boundingSphere.Center) <= (boundingSphere.Radius * boundingSphere.Radius));
        }
        public static void Intersects(ref BoundingSphere3 boundingSphere, ref BoundingBox3 boundingBox, out bool result)
        {
            Vector3 clampedLocation;
            if (boundingSphere.Center.X > boundingBox.Max.X)
            {
                clampedLocation.X = boundingBox.Max.X;
            }
            else if (boundingSphere.Center.X < boundingBox.Min.X)
            {
                clampedLocation.X = boundingBox.Min.X;
            }
            else
            {
                clampedLocation.X = boundingSphere.Center.X;
            }

            if (boundingSphere.Center.Y > boundingBox.Max.Y)
            {
                clampedLocation.Y = boundingBox.Max.Y;
            }
            else if (boundingSphere.Center.Y < boundingBox.Min.Y)
            {
                clampedLocation.Y = boundingBox.Min.Y;
            }
            else
            {
                clampedLocation.Y = boundingSphere.Center.Y;
            }

            if (boundingSphere.Center.Z > boundingBox.Max.Z)
            {
                clampedLocation.Z = boundingBox.Max.Z;
            }
            else if (boundingSphere.Center.Z < boundingBox.Min.Z)
            {
                clampedLocation.Z = boundingBox.Min.Z;
            }
            else
            {
                clampedLocation.Z = boundingSphere.Center.Z;
            }

            result = clampedLocation.DistanceSquared(boundingSphere.Center) <= (boundingSphere.Radius * boundingSphere.Radius);
        }
 public static void Intersects(ref BoundingFrustum3 boundingFrustum, ref BoundingSphere3 boundingSphere, out bool result)
 {
     throw new NotImplementedException();
 }
 public bool Intersects(BoundingSphere3 boundingSphere)
 {
     throw new NotImplementedException();
 }
 public static void Contains(ref BoundingFrustum3 boundingFrustum, ref BoundingSphere3 boundingSphere, out ContainmentTypes result)
 {
     throw new NotImplementedException();
 }
 public ContainmentTypes Contains(BoundingSphere3 boundingSphere)
 {
     throw new NotImplementedException();
 }
 public ContainmentTypes Contains(BoundingSphere3 boundingSphere)
 {
     throw new NotImplementedException();
 }
 public static void Intersects(ref BoundingFrustum3 boundingFrustum, ref BoundingSphere3 boundingSphere, out bool result)
 {
     throw new NotImplementedException();
 }
 public static void Contains(ref BoundingFrustum3 boundingFrustum, ref BoundingSphere3 boundingSphere, out ContainmentTypes result)
 {
     throw new NotImplementedException();
 }
 public bool Intersects(BoundingSphere3 boundingSphere)
 {
     throw new NotImplementedException();
 }
Beispiel #12
0
        public bool Intersects(BoundingSphere3 boundingSphere)
        {
            Vector3 clampedLocation;
            if (boundingSphere.Center.X > Max.X)
            {
                clampedLocation.X = Max.X;
            }
            else if (boundingSphere.Center.X < Min.X)
            {
                clampedLocation.X = Min.X;
            }
            else
            {
                clampedLocation.X = boundingSphere.Center.X;
            }

            if (boundingSphere.Center.Y > Max.Y)
            {
                clampedLocation.Y = Max.Y;
            }
            else if (boundingSphere.Center.Y < Min.Y)
            {
                clampedLocation.Y = Min.Y;
            }
            else
            {
                clampedLocation.Y = boundingSphere.Center.Y;
            }

            if (boundingSphere.Center.Z > Max.Z)
            {
                clampedLocation.Z = Max.Z;
            }
            else if (boundingSphere.Center.Z < Min.Z)
            {
                clampedLocation.Z = Min.Z;
            }
            else
            {
                clampedLocation.Z = boundingSphere.Center.Z;
            }

            return clampedLocation.DistanceSquared(boundingSphere.Center) <= (boundingSphere.Radius * boundingSphere.Radius);
        }