Union() приватный Метод

private Union ( RectangleF a, RectangleF b ) : RectangleF
a RectangleF
b RectangleF
Результат RectangleF
Пример #1
0
        // Union of reg1 and reg2
        public static void Union(Region reg1, Region reg2)
        {
            if (reg1 == reg2 | reg2.rects.Length == 0)
            {
                return;
            }
            if (reg1.rects.Length == 0)
            {
                reg1.rects  = (RectangleF[])reg2.rects.Clone();
                reg1.extent = reg2.extent;
                return;
            }
            // Region 1 completely subsumes region 2
            RectangleF reg1Extent = reg1.extent;
            RectangleF reg2Extent = reg2.extent;

            if (reg1.rects.Length == 1 && reg1Extent.Left <= reg2Extent.Left && reg1Extent.Top <= reg2Extent.Top && reg1Extent.Right >= reg2Extent.Right && reg1Extent.Bottom >= reg2Extent.Bottom)
            {
                return;
            }

            // Region 2 completely subsumes region 1
            if (reg2.rects.Length == 1 && (reg2Extent.Left <= reg1Extent.Left) && reg2Extent.Top <= reg1Extent.Top && reg2Extent.Right >= reg1Extent.Right && reg2Extent.Bottom >= reg1Extent.Bottom)
            {
                reg1.rects  = (RectangleF[])reg2.rects.Clone();
                reg1.extent = reg2.extent;
                return;
            }

            Region union = RegionOperation(reg1, reg2, RegionOperationType.Union);

            reg1.rects  = union.rects;
            reg1.extent = RectangleF.Union(reg1.extent, reg2.extent);
        }