/// <summary> /// Constructs a new Rectangle instance. /// </summary> /// <param name="location">The top-left corner of the Rectangle.</param> /// <param name="size">The width and height of the Rectangle.</param> public Rectangle(Point2i location, Sizei size) : this() { Location = location; Size = size; }
/// <summary> /// Constructs a new Rectangle instance. /// </summary> /// <param name="a">The left-top corner of the Rectangle.</param> /// <param name="b">The right-top corner of the Rectangle.</param> /// <param name="c">The left-bottom of the Rectangle.</param> /// <param name="d">The right-bottom of the Rectangle.</param> public Rectangle(Point2i a, Point2i b, Point2i c, Point2i d) : this() { Location = a; Size = new Sizei(d.X - c.X, d.Y - b.Y); }
/// <summary> /// Tests whether this instance contains the specified Point2i. /// </summary> /// <param name="point">The <see cref="Point2i"/> to test.</param> /// <returns>True if this instance contains point; false otherwise.</returns> /// <remarks>The left and top edges are inclusive. The right and bottom edges /// are exclusive.</remarks> public bool Contains(Point2i point) { return(point.X >= Left && point.X < Right && point.Y >= Top && point.Y < Bottom); }