Rect¶
Represents a two-dimensional rectangle comprised of position and size represented by x, y, width, and height floating point numbers with double precision.
Declaration¶
namespace bdn {
struct Rect
}
Public Member Variables¶
-
double x = 0;
A
doublerepresenting the horizontal position of theRectobject. Defaults to0. -
double y = 0;
A
doublerepresenting the vertical position of theRectobject. Defaults to0. -
double width = 0;
A
doublerepresenting the width of theRectobject. Defaults to0. -
double height = 0;
A
doublerepresenting the height of theRectobject. Defaults to0.
Creating a Rect Object¶
-
Rect()
Default-constructs a
Rectobject withx,y,width, andheightinitialized to0. -
Rect(const Point &pos, const Size &size)
Constructs a
Rectobject with the given position and size. -
Rect(double x, double y, double width, double height)
Constructs a
Rectobject with the givenx,y,width, andheight.
Retrieving Position and Size¶
-
Point position() const
Returns the rect's position as a Point object.
-
Size size() const
Returns the rect's size as a Size object.