示例#1
0
        /// <summary>
        /// Containment test between this <see cref="BoundingFrustumD"/> and specified <see cref="BoundingSphereD"/>.
        /// </summary>
        /// <param name="sphere">A <see cref="BoundingSphereD"/> for testing.</param>
        /// <param name="result">Result of testing for containment between this <see cref="BoundingFrustumD"/> and specified <see cref="BoundingSphereD"/> as an output parameter.</param>
        public void Contains(ref BoundingSphereD sphere, out ContainmentType result)
        {
            bool intersects = false;

            for (int i = 0; i < PlaneCount; i += 1)
            {
                PlaneIntersectionTypeD planeIntersectionType = default(PlaneIntersectionTypeD);

                // TODO: We might want to inline this for performance reasons.
                sphere.Intersects(ref this.planes[i], out planeIntersectionType);
                switch (planeIntersectionType)
                {
                case PlaneIntersectionTypeD.Front:
                    result = ContainmentType.Disjoint;
                    return;

                case PlaneIntersectionTypeD.Intersecting:
                    intersects = true;
                    break;
                }
            }
            result = intersects ? ContainmentType.Intersects : ContainmentType.Contains;
        }
示例#2
0
 public void Intersects(ref BoundingSphereD sphere, out PlaneIntersectionTypeD result)
 {
     sphere.Intersects(ref this, out result);
 }
示例#3
0
 public PlaneIntersectionTypeD Intersects(BoundingSphereD sphere)
 {
     return(sphere.Intersects(this));
 }