Пример #1
0
        public static bool Clip(Q1Rect a, Q1Rect b, out Q1Rect result)
        {
            int a_left   = a.Left;
            int a_bottom = a.Bottom;
            int a_right  = a.Right;
            int a_top    = a.Top;

            if (a_left < b.Left)
            {
                a_left = b.Left;
            }
            if (a_bottom < b.Bottom)
            {
                a_bottom = b.Bottom;
            }
            if (a_right > b.Right)
            {
                a_right = b.Right;
            }
            if (a_top > b.Top)
            {
                a_top = b.Top;
            }

            if (a_left <= a_right && a_bottom <= a_top)
            {
                result = new Q1Rect(a_left, a_bottom, a_right, a_top);
                return(true);
            }

            result = new Q1Rect();//empty
            return(false);
        }
Пример #2
0
        public static bool IntersectsWith(Q1Rect a, Q1Rect b)
        {
            int a_left   = a.Left;
            int a_bottom = a.Bottom;
            int a_right  = a.Right;
            int a_top    = a.Top;

            if (a_left < b.Left)
            {
                a_left = b.Left;
            }
            if (a_bottom < b.Bottom)
            {
                a_bottom = b.Bottom;
            }
            if (a_right > b.Right)
            {
                a_right = b.Right;
            }
            if (a_top > b.Top)
            {
                a_top = b.Top;
            }

            return(a_left < a_right && a_bottom < a_top);
        }
Пример #3
0
        public static void GetBoundingRect(this VertexStore vxs, ref Q1Rect rect)
        {
            Q1RectD rect1 = new Q1RectD();

            BoundingRect.GetBoundingRect(vxs, ref rect1);
            rect.Left   = (int)System.Math.Round(rect1.Left);
            rect.Bottom = (int)System.Math.Round(rect1.Bottom);
            rect.Right  = (int)System.Math.Round(rect1.Right);
            rect.Top    = (int)System.Math.Round(rect1.Top);
        }
Пример #4
0
 public void ExpandToInclude(Q1Rect rectToInclude)
 {
     if (Right < rectToInclude.Right)
     {
         Right = rectToInclude.Right;
     }
     if (Top < rectToInclude.Top)
     {
         Top = rectToInclude.Top;
     }
     if (Left > rectToInclude.Left)
     {
         Left = rectToInclude.Left;
     }
     if (Bottom > rectToInclude.Bottom)
     {
         Bottom = rectToInclude.Bottom;
     }
 }
Пример #5
0
 public RoundedRect(Q1Rect bounds, double r)
     : this(bounds.Left, bounds.Bottom, bounds.Right, bounds.Top, r)
 {
 }