Template Struct Rectangle

Struct Documentation

template<typename T>
struct Rectangle

Public Functions

constexpr Rectangle() = default
inline constexpr Rectangle(Point<T> const &top_left, Size<T> const &size)
inline Point<T> bottom_right() const

The bottom right boundary point of the rectangle.

Note that the returned point is not included in the rectangle area, that is, the rectangle is represented as [top_left,bottom_right).

inline Point<T> top_right() const
inline Point<T> bottom_left() const
inline bool contains(Point<T> const &p) const
inline bool contains(Rectangle<T> const &r) const

Test if the rectangle contains another.

Note that an empty rectangle can still contain other empty rectangles, which are treated as points or lines of thickness zero.

inline bool overlaps(Rectangle<T> const &r) const
inline X<T> left() const
inline X<T> right() const
inline Y<T> top() const
inline Y<T> bottom() const

Public Members

Point<T> top_left
Size<T> size

Friends

friend bool operator==(Rectangle const &lhs, Rectangle const &rhs) = default
friend bool operator!=(Rectangle const &lhs, Rectangle const &rhs) = default