Skip to content

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 the Rect object. Defaults to 0.

  • double y = 0;

    A double representing the vertical position of the Rect object. Defaults to 0.

  • double width = 0;

    A double representing the width of the Rect object. Defaults to 0.

  • double height = 0;

    A double representing the height of the Rect object. Defaults to 0.

Creating a Rect Object

  • Rect()

    Default-constructs a Rect object with x, y, width, and height initialized to 0.

  • 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 given x, y, width, and height.

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.

Source

Rect.h