Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        public bool Contains(RectangleFloat innerRect)
        {
            if (Contains(innerRect.Left, innerRect.Bottom) && Contains(innerRect.Right, innerRect.Top))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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);
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
		}
Exemplo n.º 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;
		}
Exemplo n.º 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;
		}
Exemplo n.º 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;
		}
Exemplo n.º 11
0
		public bool Contains(RectangleFloat innerRect)
		{
			if (Contains(innerRect.Left, innerRect.Bottom) && Contains(innerRect.Right, innerRect.Top))
			{
				return true;
			}

			return false;
		}
Exemplo n.º 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;
		}