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
double
representing the horizontal position of theRect
object. Defaults to0
. -
double y = 0;
A
double
representing the vertical position of theRect
object. Defaults to0
. -
double width = 0;
A
double
representing the width of theRect
object. Defaults to0
. -
double height = 0;
A
double
representing the height of theRect
object. Defaults to0
.
Creating a Rect Object¶
-
Rect()
Default-constructs a
Rect
object withx
,y
,width
, andheight
initialized to0
. -
Rect(const Point &pos, const Size &size)
Constructs a
Rect
object with the given position and size. -
Rect(double x, double y, double width, double height)
Constructs a
Rect
object 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.