Tinkr2/4.2/AphelionCore/AphelionCore/Core/TypeDef.cs
/// <summary>
/// Returns the combination of two rectangles
/// </summary>
/// <param name="region1">Rectangle 1</param>
/// <param name="region2">Rectangle 2</param>
/// <returns>Combined rectangle</returns>
Returns the combination of two rectangles
Returns the combination of two rectangles
public rect Combine(rect region1, rect region2)
      {
         if (region1.Width == 0)
         {
            return region2;
         }
         if (region2.Width == 0)
         {
            return region1;
         }
         int x1 = (region1.X < region2.X) ? region1.X : region2.X;
         int y1 = (region1.Y < region2.Y) ? region1.Y : region2.Y;
         int x2 = (region1.X + region1.Width > region2.X + region2.Width) ? region1.X + region1.Width : region2.X + region2.Width;
         int y2 = (region1.Y + region1.Height > region2.Y + region2.Height) ? region1.Y + region1.Height : region2.Y + region2.Height;
         return new rect(x1, y1, x2 - x1, y2 - y1);
      }
public rect Combine ( rect region1 , rect region2 ) { if ( region1 . Width == 0 ) { return region2 ; } if ( region2 . Width == 0 ) { return region1 ; } int x1 = ( region1 . X < region2 . X ) ? region1 . X : region2 . X ; int y1 = ( region1 . Y < region2 . Y ) ? region1 . Y : region2 . Y ; int x2 = ( region1 . X + region1 . Width > region2 . X + region2 . Width ) ? region1 . X + region1 . Width : region2 . X + region2 . Width ; int y2 = ( region1 . Y + region1 . Height > region2 . Y + region2 . Height ) ? region1 . Y + region1 . Height : region2 . Y + region2 . Height ; return new rect ( x1 , y1 , x2 - x1 , y2 - y1 ) ; }
Returns the combination of two rectangles
Returns the combination of two rectangles
None
region1
rect
None
region2
rect
None