Esempio n. 1
0
        public ContainmentType Contains(BoundingSphere sphere)
        {
            Vector3 result1;

            Vector3.Clamp(ref sphere.Center, ref Min, ref Max, out result1);
            float result2;

            Vector3.DistanceSquared(ref sphere.Center, ref result1, out result2);
            float radius = sphere.Radius;

            if (result2 > radius * (double)radius)
            {
                return(ContainmentType.Disjoint);
            }
            return((double)Min.X + (double)radius <= (double)sphere.Center.X &&
                   (double)sphere.Center.X <= (double)Max.X - (double)radius &&
                   ((double)Max.X - (double)Min.X > (double)radius &&
                    (double)Min.Y + (double)radius <= (double)sphere.Center.Y) &&
                   ((double)sphere.Center.Y <= (double)Max.Y - (double)radius &&
                    (double)Max.Y - (double)Min.Y > (double)radius &&
                    ((double)Min.Z + (double)radius <= (double)sphere.Center.Z &&
                     (double)sphere.Center.Z <= (double)Max.Z - (double)radius &&
                     (double)Max.X - (double)Min.X > (double)radius))
        ? ContainmentType.Contains
        : ContainmentType.Intersects);
        }
Esempio n. 2
0
        public bool Intersects(BoundingBox box)
        {
            float   num;
            Vector3 vector;

            Vector3.Clamp(ref this.Center, ref box.Min, ref box.Max, out vector);
            Vector3.DistanceSquared(ref this.Center, ref vector, out num);
            return(num <= (this.Radius * this.Radius));
        }
Esempio n. 3
0
        public bool Intersects(BoundingBox box)
        {
            Vector3 result1;

            Vector3.Clamp(ref this.Center, ref box.Min, ref box.Max, out result1);
            float result2;

            Vector3.DistanceSquared(ref this.Center, ref result1, out result2);
            return((double)result2 <= (double)this.Radius * (double)this.Radius);
        }
Esempio n. 4
0
        public ContainmentType Contains(BoundingSphere sphere)
        {
            float   num2;
            Vector3 vector;

            Vector3.Clamp(ref sphere.Center, ref this.Min, ref this.Max, out vector);
            Vector3.DistanceSquared(ref sphere.Center, ref vector, out num2);
            float radius = sphere.Radius;

            if (num2 > (radius * radius))
            {
                return(ContainmentType.Disjoint);
            }
            if (((((this.Min.X + radius) <= sphere.Center.X) && (sphere.Center.X <= (this.Max.X - radius))) && (((this.Max.X - this.Min.X) > radius) && ((this.Min.Y + radius) <= sphere.Center.Y))) && (((sphere.Center.Y <= (this.Max.Y - radius)) && ((this.Max.Y - this.Min.Y) > radius)) && ((((this.Min.Z + radius) <= sphere.Center.Z) && (sphere.Center.Z <= (this.Max.Z - radius))) && ((this.Max.X - this.Min.X) > radius))))
            {
                return(ContainmentType.Contains);
            }
            return(ContainmentType.Intersects);
        }