Пример #1
0
 public bool Equals(RectangleFloat other, float epsilon)
 {
     return(Math.Abs(Left - other.Left) <= epsilon &&
            Math.Abs(Bottom - other.Bottom) <= epsilon &&
            Math.Abs(Right - other.Right) <= epsilon &&
            Math.Abs(Top - other.Top) <= epsilon);
 }
Пример #2
0
        public bool IntersectWithRectangle(RectangleFloat rectToIntersectWith)
        {
            if (Left < rectToIntersectWith.Left)
            {
                Left = rectToIntersectWith.Left;
            }
            if (Bottom < rectToIntersectWith.Bottom)
            {
                Bottom = rectToIntersectWith.Bottom;
            }
            if (Right > rectToIntersectWith.Right)
            {
                Right = rectToIntersectWith.Right;
            }
            if (Top > rectToIntersectWith.Top)
            {
                Top = rectToIntersectWith.Top;
            }

            if (Left < Right && Bottom < Top)
            {
                return(true);
            }

            return(false);
        }
Пример #3
0
        public bool Contains(RectangleFloat innerRect)
        {
            if (Contains(innerRect.Left, innerRect.Bottom) && Contains(innerRect.Right, innerRect.Top))
            {
                return(true);
            }

            return(false);
        }
Пример #4
0
 public void ExpandToInclude(RectangleFloat 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 bool clip(RectangleFloat r)
 {
     if (Right > r.Right)
     {
         Right = r.Right;
     }
     if (Top > r.Top)
     {
         Top = r.Top;
     }
     if (Left < r.Left)
     {
         Left = r.Left;
     }
     if (Bottom < r.Bottom)
     {
         Bottom = r.Bottom;
     }
     return(Left <= Right && Bottom <= Top);
 }
Пример #6
0
 public void unite_rectangles(RectangleFloat r1, RectangleFloat r2)
 {
     Left   = r1.Left;
     Bottom = r1.Bottom;
     Right  = r1.Right;
     Right  = r1.Top;
     if (Right < r2.Right)
     {
         Right = r2.Right;
     }
     if (Top < r2.Top)
     {
         Top = r2.Top;
     }
     if (Left > r2.Left)
     {
         Left = r2.Left;
     }
     if (Bottom > r2.Bottom)
     {
         Bottom = r2.Bottom;
     }
 }
Пример #7
0
		public bool Equals(RectangleFloat other, float epsilon)
		{
			return Math.Abs(Left - other.Left) <= epsilon
				&& Math.Abs(Bottom - other.Bottom) <= epsilon
				&& Math.Abs(Right - other.Right) <= epsilon
				&& Math.Abs(Top - other.Top) <= epsilon;
		}
Пример #8
0
		public void ExpandToInclude(RectangleFloat 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;
		}
Пример #9
0
		public void unite_rectangles(RectangleFloat r1, RectangleFloat r2)
		{
			Left = r1.Left;
			Bottom = r1.Bottom;
			Right = r1.Right;
			Right = r1.Top;
			if (Right < r2.Right) Right = r2.Right;
			if (Top < r2.Top) Top = r2.Top;
			if (Left > r2.Left) Left = r2.Left;
			if (Bottom > r2.Bottom) Bottom = r2.Bottom;
		}
Пример #10
0
		public bool IntersectWithRectangle(RectangleFloat rectToIntersectWith)
		{
			if (Left < rectToIntersectWith.Left) Left = rectToIntersectWith.Left;
			if (Bottom < rectToIntersectWith.Bottom) Bottom = rectToIntersectWith.Bottom;
			if (Right > rectToIntersectWith.Right) Right = rectToIntersectWith.Right;
			if (Top > rectToIntersectWith.Top) Top = rectToIntersectWith.Top;

			if (Left < Right && Bottom < Top)
			{
				return true;
			}

			return false;
		}
Пример #11
0
		public bool Contains(RectangleFloat innerRect)
		{
			if (Contains(innerRect.Left, innerRect.Bottom) && Contains(innerRect.Right, innerRect.Top))
			{
				return true;
			}

			return false;
		}
Пример #12
0
		public bool clip(RectangleFloat r)
		{
			if (Right > r.Right) Right = r.Right;
			if (Top > r.Top) Top = r.Top;
			if (Left < r.Left) Left = r.Left;
			if (Bottom < r.Bottom) Bottom = r.Bottom;
			return Left <= Right && Bottom <= Top;
		}