Exemplo n.º 1
0
 public void Union(Rect2D r1, Rect2D r2)
 {
     if ((r2.Right == r2.Left) || (r2.Bottom == r2.Top))
     {
         Set(r1);
     }
     else if ((r1.Right == r1.Left) || (r1.Bottom == r1.Top))
     {
         Set(r2);
     }
     else
     {
         Left   = (r1.Left < r2.Left) ? r1.Left : r2.Left;
         Top    = (r1.Top > r2.Top) ? r1.Top : r2.Top;
         Right  = (r1.Right > r2.Right) ? r1.Right : r2.Right;
         Bottom = (r1.Bottom < r2.Bottom) ? r1.Bottom : r2.Bottom;
     }
 }
Exemplo n.º 2
0
 public bool Equals(Rect2D r, double epsilon)
 {
     if (!MathUtil.AreValuesEqual(MinX, r.MinX, epsilon))
     {
         return(false);
     }
     if (!MathUtil.AreValuesEqual(MaxX, r.MaxX))
     {
         return(false);
     }
     if (!MathUtil.AreValuesEqual(MinY, r.MinY, epsilon))
     {
         return(false);
     }
     if (!MathUtil.AreValuesEqual(MaxY, r.MaxY, epsilon))
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 3
0
 public bool Intersects(Rect2D r)
 {
     return((Right > r.Left) && (Left < r.Right) && (Bottom < r.Top) && (Top > r.Bottom));
 }
Exemplo n.º 4
0
 public bool ContainsInclusive(Rect2D r, double epsilon)
 {
     return(((Left - epsilon) <= r.Left) && ((Right + epsilon) >= r.Right) && ((Top - epsilon) <= r.Top) && ((Bottom + epsilon) >= r.Bottom));
 }
Exemplo n.º 5
0
 public bool ContainsInclusive(Rect2D r)
 {
     return((Left <= r.Left) && (Right >= r.Right) && (Top <= r.Top) && (Bottom >= r.Bottom));
 }
Exemplo n.º 6
0
 public bool Contains(Rect2D r)
 {
     return((Left < r.Left) && (Right > r.Right) && (Top < r.Top) && (Bottom > r.Bottom));
 }
Exemplo n.º 7
0
 public bool Equals(Rect2D r)
 {
     return(Equals(r, MathUtil.EPSILON));
 }
Exemplo n.º 8
0
 public static bool RectsIntersect(Rect2D r1, Rect2D r2)
 {
     return((r1.Right > r2.Left) && (r1.Left < r2.Right) && (r1.Bottom > r2.Top) && (r1.Top < r2.Bottom));
 }