示例#1
0
        public void Contains(ref BoundingBox box, out ContainmentType result)
        {
            var intersects = false;

            PlaneIntersectionType type;

            box.Intersects(ref near, out type);
            if (type == PlaneIntersectionType.Front)
            {
                result = ContainmentType.Disjoint;
                return;
            }
            if (type == PlaneIntersectionType.Intersecting)
            {
                intersects = true;
            }

            box.Intersects(ref left, out type);
            if (type == PlaneIntersectionType.Front)
            {
                result = ContainmentType.Disjoint;
                return;
            }
            if (type == PlaneIntersectionType.Intersecting)
            {
                intersects = true;
            }

            box.Intersects(ref right, out type);
            if (type == PlaneIntersectionType.Front)
            {
                result = ContainmentType.Disjoint;
                return;
            }
            if (type == PlaneIntersectionType.Intersecting)
            {
                intersects = true;
            }

            box.Intersects(ref top, out type);
            if (type == PlaneIntersectionType.Front)
            {
                result = ContainmentType.Disjoint;
                return;
            }
            if (type == PlaneIntersectionType.Intersecting)
            {
                intersects = true;
            }

            box.Intersects(ref bottom, out type);
            if (type == PlaneIntersectionType.Front)
            {
                result = ContainmentType.Disjoint;
                return;
            }
            if (type == PlaneIntersectionType.Intersecting)
            {
                intersects = true;
            }

            box.Intersects(ref far, out type);
            if (type == PlaneIntersectionType.Front)
            {
                result = ContainmentType.Disjoint;
                return;
            }
            if (type == PlaneIntersectionType.Intersecting)
            {
                intersects = true;
            }

            result = intersects ? ContainmentType.Intersects : ContainmentType.Contains;
        }