public static void Contains(ref BoundingFrustum boundingFrustum, ref BoundingSphere boundingSphere, out ContainmentType result) { result = ContainmentType.Contains; var planes = boundingFrustum.GetPlanes(); for (var i = 0; i < BoundingFrustum.PlaneCount; ++i) { var planeIntersectionType = default(PlaneIntersectionType); Intersects(ref boundingSphere, ref planes[i], out planeIntersectionType); if (planeIntersectionType == PlaneIntersectionType.Front) { result = ContainmentType.Disjoint; break; } else if (planeIntersectionType == PlaneIntersectionType.Intersecting) { result = ContainmentType.Intersects; break; } } }
public static void Contains(ref BoundingFrustum boundingFrustum, ref BoundingBox boundingBox, out ContainmentType result) { var planes = boundingFrustum.GetPlanes(); var intersects = false; for (var i = 0; i < BoundingFrustum.PlaneCount; ++i) { var planeIntersectionType = boundingBox.Contains(planes[i]); switch (planeIntersectionType) { case PlaneIntersectionType.Front: result = ContainmentType.Disjoint; return; case PlaneIntersectionType.Intersecting: intersects = true; break; } } result = intersects ? ContainmentType.Intersects : ContainmentType.Contains; }