Esempio n. 1
0
 public FS_RECTF Union(FS_RECTF rectangle)
 {
     return(new FS_RECTF(
                Math.Min(Left, rectangle.Left),
                Math.Max(Top, rectangle.Top),
                Math.Max(Right, rectangle.Right),
                Math.Min(Bottom, rectangle.Bottom)));
 }
Esempio n. 2
0
        public bool ContainsPartially(FS_RECTF rectangle, float minPercentContained)
        {
            if (IntersectsWith(rectangle))
            {
                // calculate area of intersection
                float left   = Math.Max(Left, rectangle.Left),
                      right  = Math.Min(Right, rectangle.Right),
                      bottom = Math.Max(Bottom, rectangle.Bottom),
                      top    = Math.Min(Top, rectangle.Top);

                float areaContained = (right - left) * (top - bottom);

                return(areaContained >= rectangle.Height * rectangle.Width * (minPercentContained / 100));
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
 public bool Contains(FS_RECTF rectangle) => Left <= rectangle.Left && Right >= rectangle.Right &&
 Top >= rectangle.Top && Bottom <= rectangle.Bottom;
Esempio n. 4
0
 public bool IntersectsWith(FS_RECTF rectangle) => (Left <rectangle.Right && Right> rectangle.Left &&
                                                    Top > rectangle.Bottom && Bottom < rectangle.Top);