Math::Rectangle struct

Represents a rectangular space, defined by two points or by the four edges.

(x1, y1) represents the point on the top-left corner; (x2, y2) represents the point on the bottom-right corner. The variables 'left', 'top', 'right' and 'bottom' can also be used to define the horizontal or vertical coordinates where each border is at.

Constructors, destructors, conversion operators

Rectangle(float x1, float y1, float x2, float y2)
Rectangle()

Public functions

auto UNNAMED(RectangleUnion) -> union
auto GetWidth() const -> float
Returns the width of the rectangle.
auto GetHeight() const -> float
Returns the height of the rectangle.
auto GetCenterX() const -> float
Returns the X coordinate that falls in the center of the rectangle.
auto GetCenterY() const -> float
Returns the Y coordinate that falls in the center of the rectangle.
auto GetCenter() const -> Point
Returns the point at the center of the rectangle.
auto GetTopLeft() const -> Point
Returns the point at the top-left corner of the rectangle.
auto GetTopRight() const -> Point
Returns the point at the top-right corner of the rectangle.
auto GetBottomLeft() const -> Point
Returns the point at the bottom-left corner of the rectangle.
auto GetBottomRight() const -> Point
Returns the point at the bottom-right corner of the rectangle.
auto Contains(float x, float y) const -> bool
Returns true if the given point is contained inside this rectangle.
auto Contains(const Point& p) const -> bool
Returns true if the given point is contained inside this rectangle.