/// <summary> /// Is this box contained by the given one? /// </summary> /// <param name="otherOne"></param> public bool IsContainedBy(BoundingBox2D otherOne) { Vector2 thisMinimum = this.Location; Vector2 thisMaximum = this.Location + this.Size; Vector2 otherMinimum = otherOne.Location; Vector2 otherMaximum = otherOne.Location + otherOne.Size; return((otherMinimum.X <= thisMinimum.X) && (otherMinimum.Y <= thisMinimum.Y) && (otherMaximum.X >= thisMaximum.X) && (otherMaximum.Y >= thisMaximum.Y)); }
/// <summary> /// Is the given smaller box contained by the given bigger one? /// </summary> /// <param name="smallerBox"></param> /// <param name="biggerBox"></param> public static bool IsContainedBy(BoundingBox2D smallerBox, BoundingBox2D biggerBox) { return(smallerBox.IsContainedBy(biggerBox)); }