예제 #1
0
        /// <summary>
        /// Check if intersects with or containing another rectangle.
        /// </summary>
        /// <param name="other">Other rectangle to check.</param>
        /// <returns>True if containing or intersecting with given rectangle.</returns>
        public bool Overlaps(RectangleI other)
        {
            // if one RectangleI is on left side of other
            if (Left > other.Right || other.Left > Right)
            {
                return(false);
            }

            // if one RectangleI is above other
            if (Top > other.Bottom || other.Top > Bottom)
            {
                return(false);
            }

            // rectangleIs overlaps
            return(true);
        }
예제 #2
0
 /// <summary>
 /// Check if containing another rectangle.
 /// </summary>
 /// <param name="other">Other rectangle to test.</param>
 /// <returns>True if other rectangle is inside this rectangle.</returns>
 public bool Contains(RectangleI other)
 {
     return(other.Left >= Left && other.Right <= Right && other.Top >= Top && other.Bottom <= Bottom);
 }