/// <summary> /// Fetches all nodes (including non leaf nodes) which intersect the given bounds /// </summary> /// <param name="bounds"></param> /// <returns></returns> public IEnumerable<Node> NodesOverlappingBounds(BoundingBox bounds) { if (!bounds.Intersects(Bounds)) yield break; yield return this; if (_children != null) foreach (var descendant in _children.SelectMany(c => c.NodesOverlappingBounds(bounds))) yield return descendant; }
/// <summary> /// Checks whether the current BoundingSphere intersects a BoundingBox. /// </summary> /// <param name="box">The BoundingBox to check for intersection with.</param><param name="result">[OutAttribute] true if the BoundingSphere and BoundingBox intersect; false otherwise.</param> public void Intersects(ref BoundingBox box, out bool result) { result = box.Intersects(this); }
/// <summary> /// Checks whether the current BoundingFrustum contains the specified BoundingBox. /// </summary> /// <param name="box">The BoundingBox to test for overlap.</param><param name="result">[OutAttribute] Enumeration indicating the extent of overlap.</param> public void Contains(ref BoundingBox box, out ContainmentType result) { CreatePlanes(); var intersects = false; for (var i = 0; i < PlaneCount; ++i) { PlaneIntersectionType planeIntersectionType; box.Intersects(ref _planes[i], out planeIntersectionType); switch (planeIntersectionType) { case PlaneIntersectionType.Front: result = ContainmentType.Disjoint; return; case PlaneIntersectionType.Intersecting: intersects = true; break; } } result = intersects ? ContainmentType.Intersects : ContainmentType.Contains; }
/// <summary> /// Checks whether the current BoundingSphere intersects with a specified BoundingBox. /// </summary> /// <param name="box">The BoundingBox to check for intersection with the current BoundingSphere.</param> public bool Intersects(BoundingBox box) { return box.Intersects(this); }