コード例 #1
0
        /// <summary>
        /// Is this box contained by the given one?
        /// </summary>
        /// <param name="otherOne"></param>
        public bool IsContainedBy(BoundingBox2D otherOne)
        {
            var thisMinimum  = Location;
            var thisMaximum  = Location + Size;
            var otherMinimum = otherOne.Location;
            var otherMaximum = otherOne.Location + otherOne.Size;

            return(otherMinimum.X <= thisMinimum.X &&
                   otherMinimum.Y <= thisMinimum.Y &&
                   otherMaximum.X >= thisMaximum.X &&
                   otherMaximum.Y >= thisMaximum.Y);
        }
コード例 #2
0
 /// <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));
 }