Rectangle
-
namespace ezgl
A library for creating a graphical user interface.
-
class rectangle
- #include <rectangle.hpp>
Represents a rectangle as two diagonally opposite points.
Public Functions
-
inline rectangle() noexcept
Default constructor: Create a zero-sized rectangle at {0,0}.
-
inline rectangle(point2d origin_pt, point2d top_right_pt)
Create a rectangle from two diagonally opposite points.
-
inline rectangle(point2d origin_pt, double rec_width, double rec_height)
Create a rectangle with a given width and height.
-
inline double left() const
The minimum x-coordinate.
-
inline double right() const
The maximum x-coordinate.
-
inline double bottom() const
The minimum y-coordinate.
-
inline double top() const
The maximum y-coordinate.
-
inline bool contains(double x, double y) const
Test if the x and y values are within the rectangle.
-
inline double width() const
The width of the rectangle.
-
inline double height() const
The height of the rectangle.
-
inline double area() const
The area of the rectangle.
-
inline double center_x() const
The center of the rectangle in the x plane.
-
inline double center_y() const
The center of the rectangle in the y plane.
Public Members
Friends
-
inline friend rectangle &operator+=(rectangle &lhs, point2d const &rhs)
translate the rectangle by positive offsets.
-
inline friend rectangle &operator-=(rectangle &lhs, point2d const &rhs)
translate the rectangle by negative offsets.
-
inline rectangle() noexcept
-
class rectangle