public Rectanglef(Rectanglef rect) : this(rect.X, rect.Y, rect.Width, rect.Height) { }
/// <summary> /// Whether or not this rectangle contains the given rectangle /// </summary> public bool Contains(Rectanglef rectangle) { if ((rectangle.Left >= Left && rectangle.Left <= Right) && (rectangle.Right <= Right && rectangle.Right >= Left) && (rectangle.Top >= Top && rectangle.Top <= Bottom) && (rectangle.Bottom >= Top && rectangle.Bottom <= Bottom)) return true; return false; }
/// <summary> /// Whether or not this rectangle intersects the given rectangle /// </summary> public bool Intersects(Rectanglef rectangle) { if ((rectangle.X >= Left && rectangle.X <= Right) || (rectangle.Y >= Top && rectangle.Y <= Bottom)) return true; return false; }
/// <summary> /// Return a VectorRectangle that Completely Contains Both value1 and value2 /// </summary> public static Rectanglef Union(Rectanglef value1, Rectanglef value2) { float left = Math.Min(value1.Left, value2.Left); float right = Math.Max(value1.Right, value2.Right); float top = Math.Min(value1.Top, value2.Top); float bottom = Math.Min(value1.Bottom, value2.Bottom); return new Rectanglef(left, top, (right - left), (bottom - top)); }